>                 } else {
> -                  byte[] content = closeClientButKeepContentStream(response);
> -                  //TODO: what is the error when the session token expires??
> -                  if (content != null && new String(content).contains("lease 
> renew")) {
> -                     logger.debug("invalidating authentication token");
> -                     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());

Minor: prefer logging using format strings like:
```java
logger.debug("too many 401s - giving up after: %s", count.intValue());
```
This way, if the log level is not enabled, the string concatenation does not 
happen (and you save the underlying StringBuilder generated stuff).

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

Reply via email to