> +   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.

I retabulated the 500 error codes and we could retry on most of these, although 
I have some concern since I have never experienced these errors:

Error Code | Error Message                                                | 
HTTP Status Code and Description
---------- | ------------------------------------------------------------ | 
--------------------------------
1001       | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1007       | The server encountered an internal error.  Please try again. | 500 
Internal Server Error
1013       | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1019       | The server encountered an I/O error.  Please try again.      | 500 
Internal Server Error 
1020       | The requested resource is missing or could not be found.     | 500 
Internal Server Error 
1024       | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1025       | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1026       | The server encountered an internal error.  Please try again. | 500 
Internal Server Error
1027       | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1028       | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1029       | The server encountered an internal error.  Please try again. | 500 
Internal Server Error 
1040       | The server is busy. Please try again                         | 500 
Internal Server Error 

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

Reply via email to