public interface Retry
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Retry.AsyncContext<T> |
static class |
Retry.AsyncRetryBlock<T> |
static interface |
Retry.Context<T>
the retry context which will be used during the retry iteration to decide what can be done on
error , result, on runtime error
|
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 |
|---|---|
<T> Retry.AsyncContext<T> |
asyncContext()
Creates a async retry Context.
|
<T> Retry.Context<T> |
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> java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> |
decorateCompletionStage(Retry retry,
java.util.concurrent.ScheduledExecutorService scheduler,
java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> supplier)
Decorates CompletionStageSupplier with Retry
|
static <E extends java.lang.Exception,T> |
decorateEitherSupplier(Retry retry,
java.util.function.Supplier<io.vavr.control.Either<E,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.
|
static <T> java.util.function.Supplier<io.vavr.control.Try<T>> |
decorateTrySupplier(Retry retry,
java.util.function.Supplier<io.vavr.control.Try<T>> supplier)
Creates a retryable supplier.
|
default <T> T |
executeCallable(java.util.concurrent.Callable<T> callable)
Decorates and executes the decorated Callable.
|
default <T> T |
executeCheckedSupplier(io.vavr.CheckedFunction0<T> checkedSupplier)
Decorates and executes the decorated Supplier.
|
default <T> java.util.concurrent.CompletionStage<T> |
executeCompletionStage(java.util.concurrent.ScheduledExecutorService scheduler,
java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> supplier)
Decorates and executes the decorated CompletionStage.
|
default <E extends java.lang.Exception,T> |
executeEitherSupplier(java.util.function.Supplier<io.vavr.control.Either<E,T>> supplier)
Decorates and executes the decorated Supplier.
|
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.
|
default <T> io.vavr.control.Try<T> |
executeTrySupplier(java.util.function.Supplier<io.vavr.control.Try<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 Retry instance.
|
java.lang.String |
getName()
Returns the ID of this Retry.
|
RetryConfig |
getRetryConfig()
Returns the RetryConfig of this Retry.
|
io.vavr.collection.Map<java.lang.String,java.lang.String> |
getTags()
Returns an unmodifiable map with tags assigned to 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,
RetryConfig retryConfig,
io.vavr.collection.Map<java.lang.String,java.lang.String> tags)
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 |
of(java.lang.String name,
java.util.function.Supplier<RetryConfig> retryConfigSupplier,
io.vavr.collection.Map<java.lang.String,java.lang.String> tags)
Creates a Retry with a custom Retry configuration.
|
static Retry |
ofDefaults(java.lang.String name)
Creates a Retry with default configuration.
|
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, RetryConfig retryConfig, io.vavr.collection.Map<java.lang.String,java.lang.String> tags)
name - the ID of the RetryretryConfig - a custom Retry configurationtags - tags to assign to the Retrystatic 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 of(java.lang.String name, java.util.function.Supplier<RetryConfig> retryConfigSupplier, io.vavr.collection.Map<java.lang.String,java.lang.String> tags)
name - the ID of the RetryretryConfigSupplier - a supplier of a custom Retry configurationtags - tags to assign to the Retrystatic Retry ofDefaults(java.lang.String name)
name - the ID of the Retrystatic <T> java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> decorateCompletionStage(Retry retry, java.util.concurrent.ScheduledExecutorService scheduler, java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> supplier)
T - type of completion stage resultretry - the retry contextscheduler - execution service to use to schedule retriessupplier - completion stage supplierstatic <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 <E extends java.lang.Exception,T> java.util.function.Supplier<io.vavr.control.Either<E,T>> decorateEitherSupplier(Retry retry, java.util.function.Supplier<io.vavr.control.Either<E,T>> supplier)
T - the type of results supplied by this supplierretry - the retry contextsupplier - the original functionstatic <T> java.util.function.Supplier<io.vavr.control.Try<T>> decorateTrySupplier(Retry retry, java.util.function.Supplier<io.vavr.control.Try<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 functionjava.lang.String getName()
<T> Retry.Context<T> context()
<T> Retry.AsyncContext<T> asyncContext()
RetryConfig getRetryConfig()
io.vavr.collection.Map<java.lang.String,java.lang.String> getTags()
Retry.EventPublisher getEventPublisher()
default <T> T executeCheckedSupplier(io.vavr.CheckedFunction0<T> checkedSupplier)
throws java.lang.Throwable
T - the type of results supplied by this suppliercheckedSupplier - the original Supplierjava.lang.Throwable - if something goes wrong applying this function to the given argumentsdefault <T> T executeSupplier(java.util.function.Supplier<T> supplier)
T - the type of results supplied by this suppliersupplier - the original Supplierdefault <E extends java.lang.Exception,T> io.vavr.control.Either<E,T> executeEitherSupplier(java.util.function.Supplier<io.vavr.control.Either<E,T>> supplier)
T - the type of results supplied by this suppliersupplier - the original Supplierdefault <T> io.vavr.control.Try<T> executeTrySupplier(java.util.function.Supplier<io.vavr.control.Try<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 Runnabledefault <T> java.util.concurrent.CompletionStage<T> executeCompletionStage(java.util.concurrent.ScheduledExecutorService scheduler,
java.util.function.Supplier<java.util.concurrent.CompletionStage<T>> supplier)
T - the type of results supplied by this supplierscheduler - execution service to use to schedule retriessupplier - the original CompletionStageRetry.Metrics getMetrics()