Class DefaultAdaptiveRetryStrategy.Builder
- All Implemented Interfaces:
AdaptiveRetryStrategy.Builder,RetryStrategy.Builder<AdaptiveRetryStrategy.Builder,,AdaptiveRetryStrategy> DefaultAwareRetryStrategy.Builder,Buildable,SdkBuilder<AdaptiveRetryStrategy.Builder,AdaptiveRetryStrategy>
- Enclosing class:
DefaultAdaptiveRetryStrategy
-
Method Summary
Modifier and TypeMethodDescriptionbackoffStrategy(BackoffStrategy backoffStrategy) Configure the backoff strategy used by the retry strategy.build()Build a newRetryStrategywith the current configuration on this builder.circuitBreakerEnabled(Boolean circuitBreakerEnabled) doNotRetryWhen(Predicate<RefreshRetryTokenRequest> doNotRetry) Configure the strategy to never retry when the provided predicate returns true, given the refresh request for the failed attempt.maxAttempts(int maxAttempts) Configure the maximum number of attempts used by the retry strategy.rateLimiterTokenBucketStore(RateLimiterTokenBucketStore rateLimiterTokenBucketStore) retries2026Enabled(Boolean retries2026Enabled) Whether retries 2.1 behavior is enabled.retryOnException(Predicate<Throwable> shouldRetry) Configure the strategy to retry when the provided predicate returns true, given a failure exception.throttlingBackoffStrategy(BackoffStrategy backoffStrategy) Configure the backoff strategy used for throttling exceptions by this strategy.throttlingTokenBucketExceptionCost(int throttlingExceptionCost) tokenBucketExceptionCost(int exceptionCost) tokenBucketStore(TokenBucketStore tokenBucketStore) treatAsThrottling(Predicate<Throwable> treatAsThrottling) Configure the predicate to allow the strategy categorize a Throwable as throttling exception.useClientDefaults(boolean useClientDefaults) Configure whether the default predicates should be used, or not.Methods inherited from class software.amazon.awssdk.retries.internal.BaseRetryStrategy.Builder
markDefaultAdded, usesRetryBehavior21Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.awssdk.retries.api.RetryStrategy.Builder
retryOnException, retryOnExceptionInstanceOf, retryOnExceptionOrCause, retryOnExceptionOrCauseInstanceOf, retryOnRootCause, retryOnRootCauseInstanceOfMethods inherited from interface software.amazon.awssdk.utils.builder.SdkBuilder
applyMutation
-
Method Details
-
retryOnException
Description copied from interface:RetryStrategy.BuilderConfigure the strategy to retry when the provided predicate returns true, given a failure exception.- Specified by:
retryOnExceptionin interfaceRetryStrategy.Builder<AdaptiveRetryStrategy.Builder,AdaptiveRetryStrategy>
-
maxAttempts
Description copied from interface:RetryStrategy.BuilderConfigure the maximum number of attempts used by the retry strategy.The actual number of attempts made may be less, depending on the retry strategy implementation. For example, the standard and adaptive retry modes both employ short-circuiting which reduces the maximum attempts during outages.
The default value for the standard and adaptive retry strategies is 3.
- Specified by:
maxAttemptsin interfaceRetryStrategy.Builder<AdaptiveRetryStrategy.Builder,AdaptiveRetryStrategy>
-
treatAsThrottling
public DefaultAdaptiveRetryStrategy.Builder treatAsThrottling(Predicate<Throwable> treatAsThrottling) Description copied from interface:AdaptiveRetryStrategy.BuilderConfigure the predicate to allow the strategy categorize a Throwable as throttling exception.- Specified by:
treatAsThrottlingin interfaceAdaptiveRetryStrategy.Builder- Specified by:
treatAsThrottlingin interfaceRetryStrategy.Builder<AdaptiveRetryStrategy.Builder,AdaptiveRetryStrategy>
-
doNotRetryWhen
public DefaultAdaptiveRetryStrategy.Builder doNotRetryWhen(Predicate<RefreshRetryTokenRequest> doNotRetry) Description copied from interface:RetryStrategy.BuilderConfigure the strategy to never retry when the provided predicate returns true, given the refresh request for the failed attempt. This takes precedence over the predicates configured withRetryStrategy.Builder.retryOnException(Predicate)and its variants. For example,RefreshRetryTokenRequest.operationName()can be used to never retry a given operation.Calling this more than once adds predicates: the request is not retried if any of them returns true.
RefreshRetryTokenRequest.operationName()is the operation name from the service model (for example,"GetObject", not"getObject"). It is empty when the strategy is not used by an SDK client, so check it withOptional.filter(java.util.function.Predicate<? super T>)orOptional.isPresent()rather thanOptional.get().If the predicate throws an exception, the SDK retry strategies log it and do not retry the request, so the original failure is returned to the caller.
The default implementation throws
UnsupportedOperationException.- Specified by:
doNotRetryWhenin interfaceRetryStrategy.Builder<AdaptiveRetryStrategy.Builder,AdaptiveRetryStrategy>
-
backoffStrategy
Description copied from interface:RetryStrategy.BuilderConfigure the backoff strategy used by the retry strategy.By default, this uses jittered exponential backoff.
- Specified by:
backoffStrategyin interfaceRetryStrategy.Builder<AdaptiveRetryStrategy.Builder,AdaptiveRetryStrategy>
-
throttlingBackoffStrategy
public DefaultAdaptiveRetryStrategy.Builder throttlingBackoffStrategy(BackoffStrategy backoffStrategy) Description copied from interface:RetryStrategy.BuilderConfigure the backoff strategy used for throttling exceptions by this strategy.By default, this uses jittered exponential backoff.
- Specified by:
throttlingBackoffStrategyin interfaceRetryStrategy.Builder<AdaptiveRetryStrategy.Builder,AdaptiveRetryStrategy>
-
circuitBreakerEnabled
-
tokenBucketExceptionCost
-
throttlingTokenBucketExceptionCost
public DefaultAdaptiveRetryStrategy.Builder throttlingTokenBucketExceptionCost(int throttlingExceptionCost) -
rateLimiterTokenBucketStore
public DefaultAdaptiveRetryStrategy.Builder rateLimiterTokenBucketStore(RateLimiterTokenBucketStore rateLimiterTokenBucketStore) -
tokenBucketStore
-
useClientDefaults
Description copied from interface:RetryStrategy.BuilderConfigure whether the default predicates should be used, or not. When set to false, only user-provided retry predicates will be considered to determine what should be retried or not. Setting this to false and providing no predicate will result in an empty retry strategy.- Specified by:
useClientDefaultsin interfaceRetryStrategy.Builder<AdaptiveRetryStrategy.Builder,AdaptiveRetryStrategy>
-
retries2026Enabled
Whether retries 2.1 behavior is enabled. -
build
Description copied from interface:RetryStrategy.BuilderBuild a newRetryStrategywith the current configuration on this builder.- Specified by:
buildin interfaceAdaptiveRetryStrategy.Builder- Specified by:
buildin interfaceBuildable- Specified by:
buildin interfaceRetryStrategy.Builder<AdaptiveRetryStrategy.Builder,AdaptiveRetryStrategy> - Specified by:
buildin interfaceSdkBuilder<AdaptiveRetryStrategy.Builder,AdaptiveRetryStrategy> - Returns:
- an instance of T
-