public interface ResilienceDecorationStrategy
Modifier and Type | Method and Description |
---|---|
default <T> Callable<T> |
decorateCallable(Callable<T> callable,
ResilienceConfiguration configuration)
Decorate an instance of a callable function.
|
<T> Callable<T> |
decorateCallable(Callable<T> callable,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate an instance of a callable function.
|
default <T> Callable<T> |
decorateFutureSupplier(Supplier<Future<T>> futureSupplier,
ResilienceConfiguration configuration)
Decorate a supplier for a future.
|
<T> Callable<T> |
decorateFutureSupplier(Supplier<Future<T>> futureSupplier,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate a supplier for a future.
|
default <T> Supplier<T> |
decorateSupplier(Supplier<T> supplier,
ResilienceConfiguration configuration)
Decorate an instance of a supplier function.
|
<T> Supplier<T> |
decorateSupplier(Supplier<T> supplier,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate an instance of a supplier function.
|
default <T> T |
executeCallable(Callable<T> callable,
ResilienceConfiguration configuration)
Decorate and execute an instance of a callable function.
|
default <T> T |
executeCallable(Callable<T> callable,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate and execute an instance of a callable function.
|
default <T> T |
executeFutureSupplier(Supplier<Future<T>> futureSupplier,
ResilienceConfiguration configuration)
Decorate and execute a supplier for a future.
|
default <T> T |
executeFutureSupplier(Supplier<Future<T>> futureSupplier,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate and execute a supplier for a future.
|
default <T> T |
executeSupplier(Supplier<T> supplier,
ResilienceConfiguration configuration)
Decorate and execute an instance of a supplier function.
|
default <T> T |
executeSupplier(Supplier<T> supplier,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate and execute an instance of a supplier function.
|
@Nonnull default <T> Supplier<T> decorateSupplier(@Nonnull Supplier<T> supplier, @Nonnull ResilienceConfiguration configuration)
T
- The return type of the call.supplier
- The supplier.configuration
- The configuration of the resilient call.@Nullable default <T> T executeSupplier(@Nonnull Supplier<T> supplier, @Nonnull ResilienceConfiguration configuration)
T
- The return type of the call.supplier
- The supplier.configuration
- The configuration of the resilient call.@Nonnull <T> Supplier<T> decorateSupplier(@Nonnull Supplier<T> supplier, @Nonnull ResilienceConfiguration configuration, @Nullable Function<? super Throwable,T> fallbackFunction)
T
- The return type of the call.supplier
- The supplier.configuration
- The configuration of the resilient call.fallbackFunction
- In case of failure, execute this function.@Nullable default <T> T executeSupplier(@Nonnull Supplier<T> supplier, @Nonnull ResilienceConfiguration configuration, @Nullable Function<? super Throwable,T> fallbackFunction)
T
- The return type of the call.supplier
- The supplier.configuration
- The configuration of the resilient call.fallbackFunction
- In case of failure, execute this function.@Nonnull default <T> Callable<T> decorateCallable(@Nonnull Callable<T> callable, @Nonnull ResilienceConfiguration configuration)
T
- The return type of the call.callable
- The callable.configuration
- The configuration of the resilient call.@Nullable default <T> T executeCallable(@Nonnull Callable<T> callable, @Nonnull ResilienceConfiguration configuration) throws Exception
T
- The return type of the call.callable
- The callable.configuration
- The configuration of the resilient call.Exception
- Exception that can be thrown by the callable.@Nonnull <T> Callable<T> decorateCallable(@Nonnull Callable<T> callable, @Nonnull ResilienceConfiguration configuration, @Nullable Function<? super Throwable,T> fallbackFunction)
T
- The return type of the call.callable
- The callable.configuration
- The configuration of the resilient call.fallbackFunction
- In case of failure, execute this function.@Nullable default <T> T executeCallable(@Nonnull Callable<T> callable, @Nonnull ResilienceConfiguration configuration, @Nullable Function<? super Throwable,T> fallbackFunction)
fallbackFunction
handles any exceptions thrown by callable
, and fallbackFunction
does not throw any exceptions
itself. If fallbackFunction
throws any exception, then it will be wrapped in a
ResilienceRuntimeException
.T
- The return type of the call.callable
- The callable.configuration
- The configuration of the resilient call.@Nonnull default <T> Callable<T> decorateFutureSupplier(@Nonnull Supplier<Future<T>> futureSupplier, @Nonnull ResilienceConfiguration configuration)
T
- The return type of the call.futureSupplier
- The supplier of a future.configuration
- The configuration of the resilient call.@Nullable default <T> T executeFutureSupplier(@Nonnull Supplier<Future<T>> futureSupplier, @Nonnull ResilienceConfiguration configuration) throws Exception
T
- The return type of the call.futureSupplier
- The supplier of a future.configuration
- The configuration of the resilient call.Exception
@Nonnull <T> Callable<T> decorateFutureSupplier(@Nonnull Supplier<Future<T>> futureSupplier, @Nonnull ResilienceConfiguration configuration, @Nullable Function<? super Throwable,T> fallbackFunction)
T
- The return type of the call.futureSupplier
- The supplier of a future.configuration
- The configuration of the resilient call.fallbackFunction
- In case of failure, execute this function.@Nullable default <T> T executeFutureSupplier(@Nonnull Supplier<Future<T>> futureSupplier, @Nonnull ResilienceConfiguration configuration, @Nullable Function<? super Throwable,T> fallbackFunction)
fallbackFunction
handles any
exceptions thrown by futureSupplier
, and fallbackFunction
does not throw any exceptions itself.
If fallbackFunction
throws any exception, then it will be wrapped in a *
ResilienceRuntimeException
.T
- The return type of the call.futureSupplier
- The supplier of a future.configuration
- The configuration of the resilient call.fallbackFunction
- In case of failure, execute this function.Copyright © 2019 SAP SE. All rights reserved.