> -                     authenticationResponseCache.invalidateAll();
> -                     retry = true;
> +                  closeClientButKeepContentStream(response);
> +                  // At this point, this is not an authentication request 
> returning 401
> +                  // Check if we already had seen this request
> +                  Integer count = retryCountMap.getIfPresent(command);
> +                  if(count!=null) {
> +                     // This request has failed before 
> +                     if(count.intValue() >= 4 ) {
> +                        logger.debug("too many 401s - giving up after: " + 
> count.intValue());
> +                        // 4 retries in the last 5 minutes; give up
> +                        return false;
> +                     } else {
> +                        // Retry just in case
> +                        logger.debug("invalidating authentication token - 
> retry " + count.intValue());
> +                        retryCountMap.put(command, new 
> Integer(count.intValue()+1));

Why not just `count + 1`?

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

Reply via email to