Package com.amazonaws.retry
Class PredefinedRetryPolicies.SDKDefaultRetryCondition
- java.lang.Object
-
- com.amazonaws.retry.PredefinedRetryPolicies.SDKDefaultRetryCondition
-
- All Implemented Interfaces:
RetryPolicy.RetryCondition
- Enclosing class:
- PredefinedRetryPolicies
public static class PredefinedRetryPolicies.SDKDefaultRetryCondition extends Object implements RetryPolicy.RetryCondition
The default implementation of RetryCondition used by the SDK. User could extend this class to provide additional custom conditions. The default implementation checks for various conditions in the following order:- Retry on client exceptions caused by IOException;
- Retry on service exceptions that are either 500 internal server errors, 503 service unavailable errors, service throttling errors or clock skew errors.
-
-
Field Summary
-
Fields inherited from interface com.amazonaws.retry.RetryPolicy.RetryCondition
NO_RETRY_CONDITION
-
-
Constructor Summary
Constructors Constructor Description SDKDefaultRetryCondition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
shouldRetry(AmazonWebServiceRequest originalRequest, AmazonClientException exception, int retriesAttempted)
Returns whether a failed request should be retried according to the given request context.
-
-
-
Method Detail
-
shouldRetry
public boolean shouldRetry(AmazonWebServiceRequest originalRequest, AmazonClientException exception, int retriesAttempted)
Description copied from interface:RetryPolicy.RetryCondition
Returns whether a failed request should be retried according to the given request context. In the following circumstances, the request will fail directly without consulting this method:- if it has already reached the max retry limit,
- if the request contains non-repeatable content,
- if any RuntimeException or Error is thrown when executing the request.
- Specified by:
shouldRetry
in interfaceRetryPolicy.RetryCondition
- Parameters:
originalRequest
- The original request object being executed. For performance reason, this object is not a defensive copy, and caller should not attempt to modify its data.exception
- The exception from the failed request, represented as an AmazonClientException object. There are two types of exception that will be passed to this method:- AmazonServiceException (sub-class of AmazonClientException) indicating a service error
- AmazonClientException caused by an IOException when executing the HTTP request.
retriesAttempted
- The number of times the current request has been attempted.- Returns:
- True if the failed request should be retried.
-
-