DefaultBackoffStrategy.java (httpcomponents-client-4.5.9-src) | : | DefaultBackoffStrategy.java (httpcomponents-client-4.5.10-src) | ||
---|---|---|---|---|
skipping to change at line 47 | skipping to change at line 47 | |||
* This {@link ConnectionBackoffStrategy} backs off either for a raw | * This {@link ConnectionBackoffStrategy} backs off either for a raw | |||
* network socket or connection timeout or if the server explicitly | * network socket or connection timeout or if the server explicitly | |||
* sends a 503 (Service Unavailable) response. | * sends a 503 (Service Unavailable) response. | |||
* | * | |||
* @since 4.2 | * @since 4.2 | |||
*/ | */ | |||
public class DefaultBackoffStrategy implements ConnectionBackoffStrategy { | public class DefaultBackoffStrategy implements ConnectionBackoffStrategy { | |||
@Override | @Override | |||
public boolean shouldBackoff(final Throwable t) { | public boolean shouldBackoff(final Throwable t) { | |||
return (t instanceof SocketTimeoutException | return t instanceof SocketTimeoutException || t instanceof ConnectExcept | |||
|| t instanceof ConnectException); | ion; | |||
} | } | |||
@Override | @Override | |||
public boolean shouldBackoff(final HttpResponse resp) { | public boolean shouldBackoff(final HttpResponse resp) { | |||
return (resp.getStatusLine().getStatusCode() == HttpStatus.SC_SERVICE_UN AVAILABLE); | return resp.getStatusLine().getStatusCode() == HttpStatus.SC_SERVICE_UNA VAILABLE; | |||
} | } | |||
} | } | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 3 lines changed or added |