Interface AdaptiveRetryStrategy
- All Superinterfaces:
RetryStrategy
- All Known Implementing Classes:
DefaultAdaptiveRetryStrategy
The adaptive retry strategy is a
RetryStrategy
when executing against a very resource-constrained set of resources.
Unlike StandardRetryStrategy
, care should be taken when using this strategy. Specifically, it should be used:
- When the availability of downstream resources are mostly affected by callers that are also using
the
AdaptiveRetryStrategy
. - The scope (either the whole strategy or the
AcquireInitialTokenRequest.scope()
) of the strategy is constrained to target "resource", so that availability issues in one resource cannot delay other, unrelated resource's availability.
The adaptive retry strategy by default:
- Retries on the conditions configured in the
AdaptiveRetryStrategy.Builder
. - Retries 2 times (3 total attempts). Adjust with
RetryStrategy.Builder.maxAttempts(int)
- Uses a dynamic backoff delay based on load currently perceived against the downstream resource
- Circuit breaking (disabling retries) in the event of high downstream failures within an individual scope. Circuit breaking may prevent a first attempt in outage scenarios to protect the downstream service.
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Create a newAdaptiveRetryStrategy.Builder
.Create a newRetryStrategy.Builder
with the current configuration.Methods inherited from interface software.amazon.awssdk.retries.api.RetryStrategy
acquireInitialToken, maxAttempts, recordSuccess, refreshRetryToken
-
Method Details
-
builder
Create a newAdaptiveRetryStrategy.Builder
.Example Usage
AdaptiveRetryStrategy retryStrategy = AdaptiveRetryStrategy.builder() .retryOnExceptionInstanceOf(IllegalArgumentException.class) .retryOnExceptionInstanceOf(IllegalStateException.class) .build();
-
toBuilder
AdaptiveRetryStrategy.Builder toBuilder()Description copied from interface:RetryStrategy
Create a newRetryStrategy.Builder
with the current configuration.This is useful for modifying the strategy's behavior, like conditions or max retries.
- Specified by:
toBuilder
in interfaceRetryStrategy
-