Object to store policy parameters used for backoff and retry recoverable errors.
Store the maximum allowable number of retries and the back-off algorithm (typically an exponential back-off) to use when recoverable HTTP errors occur.
Nested Class Summary
interface | RetryPolicy.BackOffFactory | Creates an instance of BackOff |
|
class | RetryPolicy.Builder | Builder for creating an instance of RetryPolicy |
|
class | RetryPolicy.DefaultBackOffFactoryImpl | Default factory object used to create an ExponentialBackOff with an initial delay of
1 second(s) and a multiplier of 2. |
Constant Summary
String | CONFIG_MAXIMUM_RETRIES | |
int | DEFAULT_MAXIMUM_RETRIES |
Public Method Summary
static RetryPolicy |
fromConfiguration()
Creates a retry policy using parameters specified in connector configuration file.
|
RetryPolicy.BackOffFactory |
getBackOffFactory()
Gets
RetryPolicy.BackOffFactory instance used for cmputing exponential back off. |
int |
getMaxRetryLimit()
Gets maximum number of times a failed request would be retried before marking request as
failed.
|
boolean |
isRetryableStatusCode(int statusCode)
Checks if request with
statusCode response is retryable. |
Inherited Method Summary
Constants
public static final String CONFIG_MAXIMUM_RETRIES
public static final int DEFAULT_MAXIMUM_RETRIES
Public Methods
public static RetryPolicy fromConfiguration ()
Creates a retry policy using parameters specified in connector configuration file.
maxRetryLimit=5
- maximum number of retries of failed (but recoverable) API calls.
public RetryPolicy.BackOffFactory getBackOffFactory ()
Gets RetryPolicy.BackOffFactory
instance used for cmputing exponential back off.
public int getMaxRetryLimit ()
Gets maximum number of times a failed request would be retried before marking request as failed.
public boolean isRetryableStatusCode (int statusCode)
Checks if request with statusCode
response is retryable.
Parameters
statusCode | to check |
---|
Returns
- true if request with
statusCode
response is retryable, false otherwise.