@Contract(threading=IMMUTABLE) public class DefaultServiceUnavailableRetryStrategy extends Object implements ServiceUnavailableRetryStrategy
ServiceUnavailableRetryStrategy
interface.
that retries 503
(Service Unavailable) responses for a fixed number of times
at a fixed interval.Modifier and Type | Field and Description |
---|---|
private int |
maxRetries
Maximum number of allowed retries if the server responds with a HTTP code
in our retry code list.
|
private long |
retryInterval
Retry interval between subsequent requests, in milliseconds.
|
Constructor and Description |
---|
DefaultServiceUnavailableRetryStrategy() |
DefaultServiceUnavailableRetryStrategy(int maxRetries,
int retryInterval) |
Modifier and Type | Method and Description |
---|---|
long |
getRetryInterval() |
boolean |
retryRequest(HttpResponse response,
int executionCount,
HttpContext context)
Determines if a method should be retried given the response from the target server.
|
private final int maxRetries
private final long retryInterval
public DefaultServiceUnavailableRetryStrategy(int maxRetries, int retryInterval)
public DefaultServiceUnavailableRetryStrategy()
public boolean retryRequest(HttpResponse response, int executionCount, HttpContext context)
ServiceUnavailableRetryStrategy
retryRequest
in interface ServiceUnavailableRetryStrategy
response
- the response from the target serverexecutionCount
- the number of times this method has been
unsuccessfully executedcontext
- the context for the request executiontrue
if the method should be retried, false
otherwisepublic long getRetryInterval()
getRetryInterval
in interface ServiceUnavailableRetryStrategy
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses