jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shri Javadekar <notificati...@github.com>
Subject Re: [jclouds] JCLOUDS-137: Retry on HTTP 500 AtmosError 1040 (#285)
Date Tue, 11 Feb 2014 01:37:00 GMT
> +   private int retryCountLimit = 5;
> +   @Resource
> +   protected Logger logger = Logger.NULL;
> +
> +   public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
> +      if (command.getFailureCount() > retryCountLimit) {
> +         return false;
> +      }
> +      if (response.getStatusCode() == 500) {
> +         byte[] content = HttpUtils.closeClientButKeepContentStream(response);
> +         // Content can be null in the case of HEAD requests
> +         if (content != null) {
> +            try {
> +               AtmosError error = utils.parseAtmosErrorFromContent(command, response,
> +                        new String(content));
> +               if (error.getCode() == 1040) {  // The server is busy. Please try again.

As per the pdf document you referred above, when the status code is 500, the only error code
for which we should *not* retry is 1020. For all others (including 1040), we should retry.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/285/files#r9610835
Mime
View raw message