@Contract(threading=STATELESS) public class DefaultHttpRequestRetryStrategy extends Object implements HttpRequestRetryStrategy
HttpRequestRetryStrategy interface.| Modifier and Type | Field and Description | 
|---|---|
| static DefaultHttpRequestRetryStrategy | INSTANCE | 
| Modifier | Constructor and Description | 
|---|---|
|   | DefaultHttpRequestRetryStrategy()Create the HTTP request retry strategy with a max retry count of 1,
 default retry interval of 1 second, and using the following list of
 non-retriable I/O exception classes: InterruptedIOException UnknownHostException ConnectException ConnectionClosedException SSLException and retriable HTTP status codes: SC_TOO_MANY_REQUESTS (429) SC_SERVICE_UNAVAILABLE (503) | 
|   | DefaultHttpRequestRetryStrategy(int maxRetries,
                               TimeValue defaultRetryInterval)Create the HTTP request retry strategy using the following list of
 non-retriable I/O exception classes: InterruptedIOException UnknownHostException ConnectException ConnectionClosedException SSLException and retriable HTTP status codes: SC_TOO_MANY_REQUESTS (429) SC_SERVICE_UNAVAILABLE (503) | 
| protected  | DefaultHttpRequestRetryStrategy(int maxRetries,
                               TimeValue defaultRetryInterval,
                               Collection<Class<? extends IOException>> clazzes,
                               Collection<Integer> codes) | 
| Modifier and Type | Method and Description | 
|---|---|
| TimeValue | getRetryInterval(HttpResponse response,
                int execCount,
                HttpContext context)Determines the retry interval between subsequent retries. | 
| protected boolean | handleAsIdempotent(HttpRequest request) | 
| boolean | retryRequest(HttpRequest request,
            IOException exception,
            int execCount,
            HttpContext context)Determines if a method should be retried after an I/O exception
 occured during execution. | 
| boolean | retryRequest(HttpResponse response,
            int execCount,
            HttpContext context)Determines if a method should be retried given the response from
 the target server. | 
public static final DefaultHttpRequestRetryStrategy INSTANCE
public DefaultHttpRequestRetryStrategy()
public DefaultHttpRequestRetryStrategy(int maxRetries,
                                       TimeValue defaultRetryInterval)
maxRetries - how many times to retry; 0 means no retriesdefaultRetryInterval - the default retry interval between
 subsequent retries if the Retry-After header is not set
 or invalid.protected DefaultHttpRequestRetryStrategy(int maxRetries,
                                          TimeValue defaultRetryInterval,
                                          Collection<Class<? extends IOException>> clazzes,
                                          Collection<Integer> codes)
public TimeValue getRetryInterval(HttpResponse response, int execCount, HttpContext context)
HttpRequestRetryStrategygetRetryInterval in interface HttpRequestRetryStrategyresponse - the response from the target serverexecCount - the number of times this method has been
                  unsuccessfully executedcontext - the context for the request executionprotected boolean handleAsIdempotent(HttpRequest request)
public boolean retryRequest(HttpRequest request, IOException exception, int execCount, HttpContext context)
HttpRequestRetryStrategyretryRequest in interface HttpRequestRetryStrategyrequest - the request failed due to an I/O exceptionexception - the exception that occurredexecCount - the number of times this method has been
                  unsuccessfully executedcontext - the context for the request executiontrue if the request should be retried, false
         otherwisepublic boolean retryRequest(HttpResponse response, int execCount, HttpContext context)
HttpRequestRetryStrategyretryRequest in interface HttpRequestRetryStrategyresponse - the response from the target serverexecCount - the number of times this method has been
                  unsuccessfully executedcontext - the context for the request executiontrue if the request should be retried, false
         otherwise