Interface RetryPolicy
public interface RetryPolicy
Strategy interface to define a retry policy.
Also provides factory methods and a fluent builder API for creating retry
policies with common configurations. See withDefaults(),
withMaxAttempts(long), builder(), and the configuration
options in RetryPolicy.Builder for details.
- Since:
- 7.0
- Author:
- Sam Brannen, Mahmoud Ben Hassine
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classFluent API for configuring aRetryPolicywith common configuration options. -
Method Summary
Modifier and TypeMethodDescriptionstatic RetryPolicy.Builderbuilder()Create aRetryPolicy.Builderto configure aRetryPolicywith common configuration options.default BackOffGet theBackOffstrategy to use for this retry policy.booleanshouldRetry(Throwable throwable) Specify if theRetryableoperation should be retried based on the given throwable.static RetryPolicyCreate aRetryPolicywith default configuration.static RetryPolicywithMaxAttempts(long maxAttempts) Create aRetryPolicyconfigured with a maximum number of retry attempts.
-
Method Details
-
shouldRetry
-
getBackOff
-
withDefaults
Create aRetryPolicywith default configuration.The returned policy applies to all exception types, uses a fixed backoff of 1000L milliseconds, and supports maximum 3L retry attempts.
- See Also:
-
withMaxAttempts
Create aRetryPolicyconfigured with a maximum number of retry attempts.The returned policy applies to all exception types and uses a fixed backoff of 1000L milliseconds.
- Parameters:
maxAttempts- the maximum number of retry attempts; must be positive (or zero for no retry)- See Also:
-
builder
Create aRetryPolicy.Builderto configure aRetryPolicywith common configuration options.
-