Package org.apache.http.impl.client
Class DefaultServiceUnavailableRetryStrategy
java.lang.Object
org.apache.http.impl.client.DefaultServiceUnavailableRetryStrategy
- All Implemented Interfaces:
ServiceUnavailableRetryStrategy
@Contract(threading=IMMUTABLE)
public class DefaultServiceUnavailableRetryStrategy
extends Object
implements ServiceUnavailableRetryStrategy
Default implementation of the
ServiceUnavailableRetryStrategy interface.
that retries 503 (Service Unavailable) responses for a fixed number of times
at a fixed interval.- Since:
- 4.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongbooleanretryRequest(HttpResponse response, int executionCount, HttpContext context) Determines if a method should be retried given the response from the target server.
-
Constructor Details
-
DefaultServiceUnavailableRetryStrategy
public DefaultServiceUnavailableRetryStrategy(int maxRetries, int retryInterval) -
DefaultServiceUnavailableRetryStrategy
public DefaultServiceUnavailableRetryStrategy()
-
-
Method Details
-
retryRequest
Description copied from interface:ServiceUnavailableRetryStrategyDetermines if a method should be retried given the response from the target server.- Specified by:
retryRequestin interfaceServiceUnavailableRetryStrategy- Parameters:
response- the response from the target serverexecutionCount- the number of times this method has been unsuccessfully executedcontext- the context for the request execution- Returns:
trueif the method should be retried,falseotherwise
-
getRetryInterval
public long getRetryInterval()- Specified by:
getRetryIntervalin interfaceServiceUnavailableRetryStrategy- Returns:
- The interval between the subsequent auto-retries.
-