Minor optimization

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1483735 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2013-05-17 11:01:28 +00:00
parent 013d53a64f
commit 3665ee0d37
1 changed files with 10 additions and 6 deletions

View File

@ -113,13 +113,17 @@ public class DefaultHttpRequestRetryHandler implements HttpRequestRetryHandler {
// Do not retry if over max retry count
return false;
}
for (final Class<? extends IOException> rejectException : this.nonRetriableClasses) {
if (rejectException.isInstance(exception)) {
return false;
if (this.nonRetriableClasses.contains(exception.getClass())) {
return false;
} else {
for (final Class<? extends IOException> rejectException : this.nonRetriableClasses) {
if (rejectException.isInstance(exception)) {
return false;
}
}
}
final HttpClientContext localcontext = HttpClientContext.adapt(context);
final HttpRequest request = localcontext.getRequest();
final HttpClientContext clientContext = HttpClientContext.adapt(context);
final HttpRequest request = clientContext.getRequest();
if(requestIsAborted(request)){
return false;
@ -130,7 +134,7 @@ public class DefaultHttpRequestRetryHandler implements HttpRequestRetryHandler {
return true;
}
if (!localcontext.isRequestSent() || this.requestSentRetryEnabled) {
if (!clientContext.isRequestSent() || this.requestSentRetryEnabled) {
// Retry if the request has not been sent fully or
// if it's OK to retry methods that have been sent
return true;