public interface Retry
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Retry.Context |
static interface |
Retry.EventPublisher
An EventPublisher which subscribes to the reactive stream of RetryEvents and
can be used to register event consumers.
|
static interface |
Retry.Metrics |
| Modifier and Type | Method and Description |
|---|---|
Retry.Context |
context()
Creates a retry Context.
|
static <T> java.util.concurrent.Callable<T> |
decorateCallable(Retry retry,
java.util.concurrent.Callable<T> supplier)
Creates a retryable callable.
|
static <T,R> io.vavr.CheckedFunction1<T,R> |
decorateCheckedFunction(Retry retry,
io.vavr.CheckedFunction1<T,R> function)
Creates a retryable function.
|
static io.vavr.CheckedRunnable |
decorateCheckedRunnable(Retry retry,
io.vavr.CheckedRunnable runnable)
Creates a retryable runnable.
|
static <T> io.vavr.CheckedFunction0<T> |
decorateCheckedSupplier(Retry retry,
io.vavr.CheckedFunction0<T> supplier)
Creates a retryable supplier.
|
static <T,R> java.util.function.Function<T,R> |
decorateFunction(Retry retry,
java.util.function.Function<T,R> function)
Creates a retryable function.
|
static java.lang.Runnable |
decorateRunnable(Retry retry,
java.lang.Runnable runnable)
Creates a retryable runnable.
|
static <T> java.util.function.Supplier<T> |
decorateSupplier(Retry retry,
java.util.function.Supplier<T> supplier)
Creates a retryable supplier.
|
default <T> T |
executeCallable(java.util.concurrent.Callable<T> callable)
Decorates and executes the decorated Callable.
|
default void |
executeRunnable(java.lang.Runnable runnable)
Decorates and executes the decorated Runnable.
|
default <T> T |
executeSupplier(java.util.function.Supplier<T> supplier)
Decorates and executes the decorated Supplier.
|
Retry.EventPublisher |
getEventPublisher()
Returns an EventPublisher can be used to register event consumers.
|
Retry.Metrics |
getMetrics()
Get the Metrics of this RateLimiter.
|
java.lang.String |
getName()
Returns the ID of this Retry.
|
RetryConfig |
getRetryConfig()
Returns the RetryConfig of this Retry.
|
static Retry |
of(java.lang.String name,
RetryConfig retryConfig)
Creates a Retry with a custom Retry configuration.
|
static Retry |
of(java.lang.String name,
java.util.function.Supplier<RetryConfig> retryConfigSupplier)
Creates a Retry with a custom Retry configuration.
|
static Retry |
ofDefaults(java.lang.String name)
Creates a Retry with default configuration.
|
java.lang.String getName()
Retry.Context context()
RetryConfig getRetryConfig()
Retry.EventPublisher getEventPublisher()
static Retry of(java.lang.String name, RetryConfig retryConfig)
name - the ID of the RetryretryConfig - a custom Retry configurationstatic Retry of(java.lang.String name, java.util.function.Supplier<RetryConfig> retryConfigSupplier)
name - the ID of the RetryretryConfigSupplier - a supplier of a custom Retry configurationstatic Retry ofDefaults(java.lang.String name)
name - the ID of the Retrydefault <T> T executeSupplier(java.util.function.Supplier<T> supplier)
T - the type of results supplied by this suppliersupplier - the original Supplierdefault <T> T executeCallable(java.util.concurrent.Callable<T> callable)
throws java.lang.Exception
T - the result type of callablecallable - the original Callablejava.lang.Exception - if unable to compute a resultdefault void executeRunnable(java.lang.Runnable runnable)
runnable - the original Runnablestatic <T> io.vavr.CheckedFunction0<T> decorateCheckedSupplier(Retry retry, io.vavr.CheckedFunction0<T> supplier)
T - the type of results supplied by this supplierretry - the retry contextsupplier - the original functionstatic io.vavr.CheckedRunnable decorateCheckedRunnable(Retry retry, io.vavr.CheckedRunnable runnable)
retry - the retry contextrunnable - the original runnablestatic <T,R> io.vavr.CheckedFunction1<T,R> decorateCheckedFunction(Retry retry, io.vavr.CheckedFunction1<T,R> function)
T - the type of the input to the functionR - the result type of the functionretry - the retry contextfunction - the original functionstatic <T> java.util.function.Supplier<T> decorateSupplier(Retry retry, java.util.function.Supplier<T> supplier)
T - the type of results supplied by this supplierretry - the retry contextsupplier - the original functionstatic <T> java.util.concurrent.Callable<T> decorateCallable(Retry retry, java.util.concurrent.Callable<T> supplier)
T - the type of results supplied by this supplierretry - the retry contextsupplier - the original functionstatic java.lang.Runnable decorateRunnable(Retry retry, java.lang.Runnable runnable)
retry - the retry contextrunnable - the original runnablestatic <T,R> java.util.function.Function<T,R> decorateFunction(Retry retry, java.util.function.Function<T,R> function)
T - the type of the input to the functionR - the result type of the functionretry - the retry contextfunction - the original functionRetry.Metrics getMetrics()