public static interface RetryStrategy.Builder<B extends RetryStrategy.Builder<B,T>,T extends RetryStrategy> extends SdkBuilder<B,T>
RetryStrategy.| Modifier and Type | Method and Description |
|---|---|
B |
backoffStrategy(BackoffStrategy backoffStrategy)
Configure the backoff strategy used by the retry strategy.
|
T |
build()
Build a new
RetryStrategy with the current configuration on this builder. |
B |
maxAttempts(int maxAttempts)
Configure the maximum number of attempts used by the retry strategy.
|
default B |
retryOnException(Class<? extends Throwable> throwable)
Configure the strategy to retry when a failure exception class is equal to the provided class.
|
B |
retryOnException(Predicate<Throwable> shouldRetry)
Configure the strategy to retry when the provided predicate returns true, given a failure exception.
|
default B |
retryOnExceptionInstanceOf(Class<? extends Throwable> throwable)
Configure the strategy to retry when a failure exception class is an instance of the provided class (includes
subtypes).
|
default B |
retryOnExceptionOrCause(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 B |
retryOnExceptionOrCauseInstanceOf(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 B |
retryOnRootCause(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 B |
retryOnRootCauseInstanceOf(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).
|
B |
throttlingBackoffStrategy(BackoffStrategy throttlingBackoffStrategy)
Configure the backoff strategy used for throttling exceptions by this strategy.
|
B |
treatAsThrottling(Predicate<Throwable> treatAsThrottling)
Configure a predicate that determines whether a retryable exception is a throttling exception.
|
default B |
useClientDefaults(boolean useClientDefaults)
Configure whether the default predicates should be used, or not.
|
applyMutationB retryOnException(Predicate<Throwable> shouldRetry)
default B retryOnException(Class<? extends Throwable> throwable)
default B retryOnExceptionInstanceOf(Class<? extends Throwable> throwable)
default B retryOnExceptionOrCause(Class<? extends Throwable> throwable)
default B retryOnExceptionOrCauseInstanceOf(Class<? extends Throwable> throwable)
default B retryOnRootCause(Class<? extends Throwable> throwable)
default B retryOnRootCauseInstanceOf(Class<? extends Throwable> throwable)
B maxAttempts(int maxAttempts)
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.
B backoffStrategy(BackoffStrategy backoffStrategy)
By default, this uses jittered exponential backoff.
B throttlingBackoffStrategy(BackoffStrategy throttlingBackoffStrategy)
By default, this uses jittered exponential backoff.
B treatAsThrottling(Predicate<Throwable> treatAsThrottling)
throttlingBackoffStrategy(com.ibm.cos.v2.retries.api.BackoffStrategy). If it returns false, the
backoffStrategy(com.ibm.cos.v2.retries.api.BackoffStrategy) will be used. This predicate will not be called for non-retryable exceptions.default B useClientDefaults(boolean useClientDefaults)
T build()
RetryStrategy with the current configuration on this builder.build in interface Buildablebuild in interface SdkBuilder<B extends RetryStrategy.Builder<B,T>,T extends RetryStrategy>Copyright © 2026. All rights reserved.