Package com.amazonaws.retry
Class RetryPolicy
java.lang.Object
com.amazonaws.retry.RetryPolicy
Retry policy that can be configured on a specific service client using
ClientConfiguration
. This class is immutable, therefore safe to be
shared by multiple clients.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
The hook for providing custom back-off strategy to control the sleep time between retries.static interface
The hook for providing custom condition on whether a failed request should be retried. -
Constructor Summary
ConstructorsConstructorDescriptionRetryPolicy
(RetryPolicy.RetryCondition retryCondition, RetryPolicy.BackoffStrategy backoffStrategy, int maxErrorRetry, boolean honorMaxErrorRetryInClientConfig) Constructs a new retry policy. -
Method Summary
Modifier and TypeMethodDescriptionReturns the back-off strategy included in this retry policy.int
Returns the maximum number of retry attempts.Returns the retry condition included in this retry policy.boolean
Returns whether this retry policy should honor the max error retry set in ClientConfiguration.
-
Constructor Details
-
RetryPolicy
public RetryPolicy(RetryPolicy.RetryCondition retryCondition, RetryPolicy.BackoffStrategy backoffStrategy, int maxErrorRetry, boolean honorMaxErrorRetryInClientConfig) Constructs a new retry policy. SeePredefinedRetryPolicies
for some pre-defined policy components, and also the default policies used by SDK.- Parameters:
retryCondition
- Retry condition on whether a specific request and exception should be retried. If null value is specified, the SDK' default retry condition is used.backoffStrategy
- Back-off strategy for controlling how long the next retry should wait. If null value is specified, the SDK' default exponential back-off strategy is used.maxErrorRetry
- Maximum number of retry attempts for failed requests.honorMaxErrorRetryInClientConfig
- Whether this retry policy should honor the max error retry set byClientConfiguration.setMaxErrorRetry(int)
- See Also:
-
-
Method Details
-
getRetryCondition
Returns the retry condition included in this retry policy.- Returns:
- The retry condition included in this retry policy.
-
getBackoffStrategy
Returns the back-off strategy included in this retry policy.- Returns:
- The back-off strategy included in this retry policy.
-
getMaxErrorRetry
public int getMaxErrorRetry()Returns the maximum number of retry attempts.- Returns:
- The maximum number of retry attempts.
-
isMaxErrorRetryInClientConfigHonored
public boolean isMaxErrorRetryInClientConfigHonored()Returns whether this retry policy should honor the max error retry set in ClientConfiguration.- Returns:
- Whether this retry policy should honor the max error retry set in ClientConfiguration
- See Also:
-