Class DefaultHttpMethodRetryHandler
java.lang.Object
org.apache.commons.httpclient.DefaultHttpMethodRetryHandler
- All Implemented Interfaces:
HttpMethodRetryHandler
The default
HttpMethodRetryHandler used by HttpMethods.- Author:
- Michael Becke, Oleg Kalnichevski
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new DefaultHttpMethodRetryHandler that retries up to 3 times but does not retry methods that have successfully sent their requests.DefaultHttpMethodRetryHandler(int retryCount, boolean requestSentRetryEnabled) Creates a new DefaultHttpMethodRetryHandler. -
Method Summary
Modifier and TypeMethodDescriptionintbooleanbooleanretryMethod(HttpMethod method, IOException exception, int executionCount) UsedretryCountandrequestSentRetryEnabledto determine if the given method should be retried.
-
Constructor Details
-
DefaultHttpMethodRetryHandler
public DefaultHttpMethodRetryHandler(int retryCount, boolean requestSentRetryEnabled) Creates a new DefaultHttpMethodRetryHandler.- Parameters:
retryCount- the number of times a method will be retriedrequestSentRetryEnabled- if true, methods that have successfully sent their request will be retried
-
DefaultHttpMethodRetryHandler
public DefaultHttpMethodRetryHandler()Creates a new DefaultHttpMethodRetryHandler that retries up to 3 times but does not retry methods that have successfully sent their requests.
-
-
Method Details
-
retryMethod
UsedretryCountandrequestSentRetryEnabledto determine if the given method should be retried.- Specified by:
retryMethodin interfaceHttpMethodRetryHandler- Parameters:
method- the method being executedexception- the exception that occurredexecutionCount- the number of times this method has been unsuccessfully executed- Returns:
trueif the method should be retried,falseotherwise- See Also:
-
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
-