Interface RetryStrategy.Builder<B extends RetryStrategy.Builder<B,T>,T extends RetryStrategy>
- All Superinterfaces:
Buildable,SdkBuilder<B,T>
- Enclosing interface:
- RetryStrategy
public static interface RetryStrategy.Builder<B extends RetryStrategy.Builder<B,T>,T extends RetryStrategy>
extends SdkBuilder<B,T>
Builder to create immutable instances of
RetryStrategy.-
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.maxAttempts(int maxAttempts) Configure the maximum number of attempts used by the retry strategy.default BretryOnException(Class<? extends Throwable> throwable) Configure the strategy to retry when a failure exception class is equal to the provided class.retryOnException(Predicate<Throwable> shouldRetry) Configure the strategy to retry when the provided predicate returns true, given a failure exception.default BretryOnExceptionInstanceOf(Class<? extends Throwable> throwable) Configure the strategy to retry when a failure exception class is an instance of the provided class (includes subtypes).default BretryOnExceptionOrCause(Class<? extends Throwable> throwable) Configure the strategy to retry when a failure exception or one of its cause classes is equal to the provided class.default BretryOnExceptionOrCauseInstanceOf(Class<? extends Throwable> throwable) Configure the strategy to retry when a failure exception or one of its cause classes is an instance of the provided class (includes subtypes).default BretryOnRootCause(Class<? extends Throwable> throwable) Configure the strategy to retry the root cause of a failure (the final cause) a failure exception is equal to the provided class.default BretryOnRootCauseInstanceOf(Class<? extends Throwable> throwable) Configure the strategy to retry the root cause of a failure (the final cause) a failure exception is an instance of to the provided class (includes subtypes).throttlingBackoffStrategy(BackoffStrategy throttlingBackoffStrategy) Configure the backoff strategy used for throttling exceptions by this strategy.treatAsThrottling(Predicate<Throwable> treatAsThrottling) Configure a predicate that determines whether a retryable exception is a throttling exception.default BuseClientDefaults(boolean useClientDefaults) Configure whether the default predicates should be used, or not.Methods inherited from interface software.amazon.awssdk.utils.builder.SdkBuilder
applyMutation
-
Method Details
-
retryOnException
Configure the strategy to retry when the provided predicate returns true, given a failure exception. -
retryOnException
Configure the strategy to retry when a failure exception class is equal to the provided class. -
retryOnExceptionInstanceOf
Configure the strategy to retry when a failure exception class is an instance of the provided class (includes subtypes). -
retryOnExceptionOrCause
Configure the strategy to retry when a failure exception or one of its cause classes is equal to the provided class. -
retryOnExceptionOrCauseInstanceOf
Configure the strategy to retry when a failure exception or one of its cause classes is an instance of the provided class (includes subtypes). -
retryOnRootCause
Configure the strategy to retry the root cause of a failure (the final cause) a failure exception is equal to the provided class. -
retryOnRootCauseInstanceOf
Configure the strategy to retry the root cause of a failure (the final cause) a failure exception is an instance of to the provided class (includes subtypes). -
maxAttempts
Configure 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.
-
backoffStrategy
Configure the backoff strategy used by the retry strategy.By default, this uses jittered exponential backoff.
-
throttlingBackoffStrategy
Configure the backoff strategy used for throttling exceptions by this strategy.By default, this uses jittered exponential backoff.
-
treatAsThrottling
Configure a predicate that determines whether a retryable exception is a throttling exception. When this predicate returns true, the retry strategy will use thethrottlingBackoffStrategy(software.amazon.awssdk.retries.api.BackoffStrategy). If it returns false, thebackoffStrategy(software.amazon.awssdk.retries.api.BackoffStrategy)will be used. This predicate will not be called for non-retryable exceptions. -
useClientDefaults
Configure 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. -
build
T build()Build a newRetryStrategywith the current configuration on this builder.- Specified by:
buildin interfaceBuildable- Specified by:
buildin interfaceSdkBuilder<B extends RetryStrategy.Builder<B,T>, T extends RetryStrategy>
-