Issue 71: retry on 400/RequestTimeout and 409/OperationAborted

git-svn-id: http://jclouds.googlecode.com/svn/trunk@1495 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-06-29 14:41:56 +00:00
parent 9072a949d3
commit 83a2d93459
2 changed files with 4 additions and 3 deletions

View File

@ -60,13 +60,14 @@ public class AWSClientErrorRetryHandler implements HttpRetryHandler {
public boolean shouldRetryRequest(HttpFutureCommand<?> command, HttpResponse response) {
if (command.getFailureCount() > retryCountLimit)
return false;
if (response.getStatusCode() == 400) {
if (response.getStatusCode() == 400 || response.getStatusCode() == 409) {
byte[] content = S3Utils.closeConnectionButKeepContentStream(response);
command.incrementRedirectCount();
try {
AWSError error = S3Utils.parseAWSErrorFromContent(parserFactory, command, response,
new String(content));
if ("RequestTimeout".equals(error.getCode())) {
if ("RequestTimeout".equals(error.getCode())
|| "OperationAborted".equals(error.getCode())) {
return true;
}
} catch (HttpException e) {

View File

@ -93,7 +93,7 @@ public class ParseSax<T> extends HttpFutureCommand.ResponseCallable<T> {
IOUtils.closeQuietly(xml);
xml = IOUtils.toInputStream(response);
}
InputSource input = new InputSource(new InputStreamReader(xml,"UTF-8"));
InputSource input = new InputSource(new InputStreamReader(xml, "UTF-8"));
parser.parse(input);
} catch (Exception e) {
StringBuilder message = new StringBuilder();