public static final class ResilienceConfiguration.RetryConfiguration extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_ATTEMPTS
The default number for maximum attempts.
|
static Predicate<Throwable> |
DEFAULT_RETRY_ON_EXCEPTION_PREDICATE
The default predicate for retrying if any exception occurs.
|
static Duration |
DEFAULT_WAIT_DURATION
The default waiting duration time.
|
Modifier and Type | Method and Description |
---|---|
static ResilienceConfiguration.RetryConfiguration |
disabled()
Instantiate a new
RetryConfiguration that only permits a single attempt, effectively disabling
retries. |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isEnabled()
Get the status indicator for the Retry.
|
int |
maxAttempts()
The maximum number of total attempts.
|
static ResilienceConfiguration.RetryConfiguration |
of(int maxAttempts)
Instantiate a new
RetryConfiguration with the given parameter. |
static ResilienceConfiguration.RetryConfiguration |
of(int maxAttempts,
Duration waitDuration)
Instantiate a new
RetryConfiguration with the given parameters. |
static ResilienceConfiguration.RetryConfiguration |
ofDefaults()
Deprecated.
Please use
of(int) instead. |
@NonNull Predicate<Throwable> |
retryOnExceptionPredicate()
A predicate which evaluates if an exception should be retried.
|
ResilienceConfiguration.RetryConfiguration |
retryOnExceptionPredicate(@NonNull Predicate<Throwable> retryOnExceptionPredicate)
A predicate which evaluates if an exception should be retried.
|
@NonNull Duration |
waitDuration()
The duration to wait before retrying.
|
ResilienceConfiguration.RetryConfiguration |
waitDuration(@NonNull Duration waitDuration)
The duration to wait before retrying.
|
public static final int DEFAULT_MAX_ATTEMPTS
public static final Duration DEFAULT_WAIT_DURATION
public boolean isEnabled()
@Nonnull @Deprecated public static ResilienceConfiguration.RetryConfiguration ofDefaults()
of(int)
instead.RetryConfiguration
with the following default values:
Maximum number of attempts: | 3 |
Wait duration between retries: | DEFAULT_WAIT_DURATION |
Exceptions to be retried: | All exceptions |
RetryConfiguration
.@Nonnull public static ResilienceConfiguration.RetryConfiguration of(int maxAttempts, @Nonnull Duration waitDuration)
RetryConfiguration
with the given parameters.maxAttempts
- The maximum number of attempts to successfully execute a request.waitDuration
- The time duration the system will wait before retrying.RetryConfiguration
.@Nonnull public static ResilienceConfiguration.RetryConfiguration of(int maxAttempts)
RetryConfiguration
with the given parameter. Before retrying the system will wait
for DEFAULT_WAIT_DURATION.maxAttempts
- The maximum number of attempts to successfully execute a request.RetryConfiguration
.@Nonnull public static ResilienceConfiguration.RetryConfiguration disabled()
RetryConfiguration
that only permits a single attempt, effectively disabling
retries.RetryConfiguration
.public int maxAttempts()
@NonNull public @NonNull Duration waitDuration()
@NonNull public @NonNull Predicate<Throwable> retryOnExceptionPredicate()
public ResilienceConfiguration.RetryConfiguration waitDuration(@NonNull @NonNull Duration waitDuration)
this
.public ResilienceConfiguration.RetryConfiguration retryOnExceptionPredicate(@NonNull @NonNull Predicate<Throwable> retryOnExceptionPredicate)
this
.Copyright © 2020 SAP SE. All rights reserved.