public static class RetryConfig.Builder
extends java.lang.Object
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
RetryConfig |
build() |
RetryConfig.Builder |
ignoreExceptions(java.lang.Class<? extends java.lang.Throwable>... errorClasses)
Configures a list of error classes that are ignored and thus are not retried.
|
RetryConfig.Builder |
intervalFunction(IntervalFunction f)
Set a function to modify the waiting interval
after a failure.
|
RetryConfig.Builder |
maxAttempts(int maxAttempts) |
RetryConfig.Builder |
retryExceptions(java.lang.Class<? extends java.lang.Throwable>... errorClasses)
Configures a list of error classes that are recorded as a failure and thus increase the failure rate.
|
RetryConfig.Builder |
retryOnException(java.util.function.Predicate<java.lang.Throwable> predicate)
Configures a Predicate which evaluates if an exception should be retried.
|
RetryConfig.Builder |
waitDuration(java.time.Duration waitDuration) |
public RetryConfig.Builder maxAttempts(int maxAttempts)
public RetryConfig.Builder waitDuration(java.time.Duration waitDuration)
public RetryConfig.Builder intervalFunction(IntervalFunction f)
f - Function to modify the interval after a failurepublic RetryConfig.Builder retryOnException(java.util.function.Predicate<java.lang.Throwable> predicate)
predicate - the Predicate which evaluates if an exception should be retried or not.@SafeVarargs public final RetryConfig.Builder retryExceptions(java.lang.Class<? extends java.lang.Throwable>... errorClasses)
errorClasses - the error classes that are retried). Ignoring an exception has priority over retrying an exception.
Example:
retryOnExceptions(Throwable.class) and ignoreExceptions(RuntimeException.class)
would retry all Errors and checked Exceptions, and ignore unchecked
For a more sophisticated exception management use the,
method@SafeVarargs public final RetryConfig.Builder ignoreExceptions(java.lang.Class<? extends java.lang.Throwable>... errorClasses)
errorClasses - the error classes that are retried. Ignoring an exception has priority over retrying an exception.
Example:
ignoreExceptions(Throwable.class) and retryOnExceptions(Exception.class)
would capture nothing
Example:
ignoreExceptions(Exception.class) and retryOnExceptions(Throwable.class)
would capture Errors
For a more sophisticated exception management use the,
methodpublic RetryConfig build()