>                    } else {
> -                     retry = false;
> +                     // This request has failed before
> +                     if (count >= 4) {
> +                        logger.debug("too many 401s - giving up after: %s 
> for %s", count, command);
> +                        // 4 retries in the last 5 minutes; give up
> +                        return false;
> +                     } else {
> +                        // Retry just in case
> +                        logger.debug("invalidating authentication token - 
> retry %s for %s", count, command);
> +                        retryCountMap.put(command, count + 1);
> +                        // Wait between retries
> +                        authenticationResponseCache.invalidateAll();
> +                        Uninterruptibles.sleepUninterruptibly(5, 
> TimeUnit.SECONDS);

Shouldn't the calling code do the backoff for us?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/104/files#r6357493

Reply via email to