Package org.apache.http.impl.client
Class DefaultHttpRequestRetryHandler
- java.lang.Object
-
- org.apache.http.impl.client.DefaultHttpRequestRetryHandler
-
- All Implemented Interfaces:
HttpRequestRetryHandler
- Direct Known Subclasses:
StandardHttpRequestRetryHandler
@Contract(threading=IMMUTABLE) public class DefaultHttpRequestRetryHandler extends java.lang.Object implements HttpRequestRetryHandler
The defaultHttpRequestRetryHandlerused by request executors.- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description static DefaultHttpRequestRetryHandlerINSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description DefaultHttpRequestRetryHandler()Create the request retry handler with a retry count of 3, requestSentRetryEnabled false and using the following list of non-retriable IOException classes:
InterruptedIOException UnknownHostException ConnectException SSLExceptionDefaultHttpRequestRetryHandler(int retryCount, boolean requestSentRetryEnabled)Create the request retry handler using the following list of non-retriable IOException classes:
InterruptedIOException UnknownHostException ConnectException SSLExceptionprotectedDefaultHttpRequestRetryHandler(int retryCount, boolean requestSentRetryEnabled, java.util.Collection<java.lang.Class<? extends java.io.IOException>> clazzes)Create the request retry handler using the specified IOException classes
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intgetRetryCount()protected booleanhandleAsIdempotent(org.apache.http.HttpRequest request)booleanisRequestSentRetryEnabled()protected booleanrequestIsAborted(org.apache.http.HttpRequest request)Deprecated.(4.3)booleanretryRequest(java.io.IOException exception, int executionCount, org.apache.http.protocol.HttpContext context)UsedretryCountandrequestSentRetryEnabledto determine if the given method should be retried.
-
-
-
Field Detail
-
INSTANCE
public static final DefaultHttpRequestRetryHandler INSTANCE
-
-
Constructor Detail
-
DefaultHttpRequestRetryHandler
protected DefaultHttpRequestRetryHandler(int retryCount, boolean requestSentRetryEnabled, java.util.Collection<java.lang.Class<? extends java.io.IOException>> clazzes)Create the request retry handler using the specified IOException classes- Parameters:
retryCount- how many times to retry; 0 means no retriesrequestSentRetryEnabled- true if it's OK to retry requests that have been sentclazzes- the IOException types that should not be retried- Since:
- 4.3
-
DefaultHttpRequestRetryHandler
public DefaultHttpRequestRetryHandler(int retryCount, boolean requestSentRetryEnabled)Create the request retry handler using the following list of non-retriable IOException classes:
- InterruptedIOException
- UnknownHostException
- ConnectException
- SSLException
- Parameters:
retryCount- how many times to retry; 0 means no retriesrequestSentRetryEnabled- true if it's OK to retry non-idempotent requests that have been sent
-
DefaultHttpRequestRetryHandler
public DefaultHttpRequestRetryHandler()
Create the request retry handler with a retry count of 3, requestSentRetryEnabled false and using the following list of non-retriable IOException classes:
- InterruptedIOException
- UnknownHostException
- ConnectException
- SSLException
-
-
Method Detail
-
retryRequest
public boolean retryRequest(java.io.IOException exception, int executionCount, org.apache.http.protocol.HttpContext context)UsedretryCountandrequestSentRetryEnabledto determine if the given method should be retried.- Specified by:
retryRequestin interfaceHttpRequestRetryHandler- Parameters:
exception- the exception that occurredexecutionCount- the number of times this method has been unsuccessfully executedcontext- the context for the request execution- Returns:
trueif the method should be retried,falseotherwise
-
isRequestSentRetryEnabled
public boolean isRequestSentRetryEnabled()
- Returns:
trueif this handler will retry methods that have successfully sent their request,falseotherwise
-
getRetryCount
public int getRetryCount()
- Returns:
- the maximum number of times a method will be retried
-
handleAsIdempotent
protected boolean handleAsIdempotent(org.apache.http.HttpRequest request)
- Since:
- 4.2
-
requestIsAborted
@Deprecated protected boolean requestIsAborted(org.apache.http.HttpRequest request)
Deprecated.(4.3)- Since:
- 4.2
-
-