mirror of
https://github.com/apache/jclouds.git
synced 2025-02-16 15:08:28 +00:00
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:
parent
9072a949d3
commit
83a2d93459
@ -60,13 +60,14 @@ public class AWSClientErrorRetryHandler implements HttpRetryHandler {
|
|||||||
public boolean shouldRetryRequest(HttpFutureCommand<?> command, HttpResponse response) {
|
public boolean shouldRetryRequest(HttpFutureCommand<?> command, HttpResponse response) {
|
||||||
if (command.getFailureCount() > retryCountLimit)
|
if (command.getFailureCount() > retryCountLimit)
|
||||||
return false;
|
return false;
|
||||||
if (response.getStatusCode() == 400) {
|
if (response.getStatusCode() == 400 || response.getStatusCode() == 409) {
|
||||||
byte[] content = S3Utils.closeConnectionButKeepContentStream(response);
|
byte[] content = S3Utils.closeConnectionButKeepContentStream(response);
|
||||||
command.incrementRedirectCount();
|
command.incrementRedirectCount();
|
||||||
try {
|
try {
|
||||||
AWSError error = S3Utils.parseAWSErrorFromContent(parserFactory, command, response,
|
AWSError error = S3Utils.parseAWSErrorFromContent(parserFactory, command, response,
|
||||||
new String(content));
|
new String(content));
|
||||||
if ("RequestTimeout".equals(error.getCode())) {
|
if ("RequestTimeout".equals(error.getCode())
|
||||||
|
|| "OperationAborted".equals(error.getCode())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (HttpException e) {
|
} catch (HttpException e) {
|
||||||
|
@ -93,7 +93,7 @@ public class ParseSax<T> extends HttpFutureCommand.ResponseCallable<T> {
|
|||||||
IOUtils.closeQuietly(xml);
|
IOUtils.closeQuietly(xml);
|
||||||
xml = IOUtils.toInputStream(response);
|
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);
|
parser.parse(input);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
StringBuilder message = new StringBuilder();
|
StringBuilder message = new StringBuilder();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user