public final class ResilienceDecorator extends Object
Constructor and Description |
---|
ResilienceDecorator() |
Modifier and Type | Method and Description |
---|---|
static <T> Callable<T> |
decorateCallable(Callable<T> callable,
ResilienceConfiguration configuration)
Decorate an instance of a callable function.
|
static <T> Callable<T> |
decorateCallable(Callable<T> callable,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate an instance of a callable function.
|
static <T> Callable<T> |
decorateFutureSupplier(Supplier<Future<T>> futureSupplier,
ResilienceConfiguration configuration)
Deprecated.
Not for public use. This method is expected to be temporarily retained only as a package private
method. Instead use
decorateCallable(Callable, ResilienceConfiguration) or
decorateSupplier(Supplier, ResilienceConfiguration) , depending on the expected error
handling. Also consider the sibling methods featuring a fallback routine. |
static <T> Callable<T> |
decorateFutureSupplier(Supplier<Future<T>> futureSupplier,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Deprecated.
Not for public use. This method is expected to be temporarily retained only as a package private
method. Instead use
decorateCallable(Callable, ResilienceConfiguration) or
decorateSupplier(Supplier, ResilienceConfiguration) , depending on the expected error
handling. Also consider the sibling methods featuring a fallback routine. |
static <T> Supplier<T> |
decorateSupplier(Supplier<T> supplier,
ResilienceConfiguration configuration)
Decorate an instance of a supplier function.
|
static <T> Supplier<T> |
decorateSupplier(Supplier<T> supplier,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate an instance of a supplier function.
|
static <T> T |
executeCallable(Callable<T> callable,
ResilienceConfiguration configuration)
Decorate and execute an instance of a callable function.
|
static <T> T |
executeCallable(Callable<T> callable,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate and execute an instance of a callable function.
|
static <T> T |
executeFutureSupplier(Supplier<Future<T>> futureSupplier,
ResilienceConfiguration configuration)
Deprecated.
Not for public use. This method is expected to be temporarily retained only as a package private
method. Instead use
executeCallable(Callable, ResilienceConfiguration) or
executeSupplier(Supplier, ResilienceConfiguration) , depending on the expected error
handling. Also consider the sibling methods featuring a fallback routine. |
static <T> T |
executeFutureSupplier(Supplier<Future<T>> futureSupplier,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Deprecated.
Not for public use. This method is expected to be temporarily retained only as a package private
method. Instead use
executeCallable(Callable, ResilienceConfiguration) or
executeSupplier(Supplier, ResilienceConfiguration) , depending on the expected error
handling. Also consider the sibling methods featuring a fallback routine. |
static <T> T |
executeSupplier(Supplier<T> supplier,
ResilienceConfiguration configuration)
Decorate and execute an instance of a supplier function.
|
static <T> T |
executeSupplier(Supplier<T> supplier,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate and execute an instance of a supplier function.
|
static ResilienceDecorationStrategy |
getDecorationStrategy()
The current instance of
ResilienceDecorationStrategy to be used to guarantee resilient function
properties. |
static <T> CompletableFuture<T> |
queueCallable(Callable<T> callable,
ResilienceConfiguration configuration)
Decorate an instance of a callable function.
|
static <T> CompletableFuture<T> |
queueCallable(Callable<T> callable,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate an instance of a callable function.
|
static <T> CompletableFuture<T> |
queueSupplier(Supplier<T> supplier,
ResilienceConfiguration configuration)
Decorate an instance of a supplier function.
|
static <T> CompletableFuture<T> |
queueSupplier(Supplier<T> supplier,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate an instance of a supplier function.
|
static void |
resetDecorationStrategy()
Resets the decoration strategy to its default.
|
static void |
setDecorationStrategy(ResilienceDecorationStrategy decorationStrategy)
The current instance of
ResilienceDecorationStrategy to be used to guarantee resilient function
properties. |
public static void resetDecorationStrategy()
@Nonnull public static <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 public static <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 public static <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 public static <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 public static <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 public static <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 public static <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 public static <T> T executeCallable(@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.@Nonnull @Deprecated public static <T> Callable<T> decorateFutureSupplier(@Nonnull Supplier<Future<T>> futureSupplier, @Nonnull ResilienceConfiguration configuration)
decorateCallable(Callable, ResilienceConfiguration)
or
decorateSupplier(Supplier, ResilienceConfiguration)
, depending on the expected error
handling. Also consider the sibling methods featuring a fallback routine.T
- The return type of the call.futureSupplier
- The supplier of a future.configuration
- The configuration of the resilient call.@Nullable @Deprecated public static <T> T executeFutureSupplier(@Nonnull Supplier<Future<T>> futureSupplier, @Nonnull ResilienceConfiguration configuration) throws Exception
executeCallable(Callable, ResilienceConfiguration)
or
executeSupplier(Supplier, ResilienceConfiguration)
, depending on the expected error
handling. Also consider the sibling methods featuring a fallback routine.T
- The return type of the call.futureSupplier
- The supplier of a future.configuration
- The configuration of the resilient call.Exception
@Nonnull @Deprecated public static <T> Callable<T> decorateFutureSupplier(@Nonnull Supplier<Future<T>> futureSupplier, @Nonnull ResilienceConfiguration configuration, @Nullable Function<? super Throwable,T> fallbackFunction)
decorateCallable(Callable, ResilienceConfiguration)
or
decorateSupplier(Supplier, ResilienceConfiguration)
, depending on the expected error
handling. Also consider the sibling methods featuring a fallback routine.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 @Deprecated public static <T> T executeFutureSupplier(@Nonnull Supplier<Future<T>> futureSupplier, @Nonnull ResilienceConfiguration configuration, @Nullable Function<? super Throwable,T> fallbackFunction)
executeCallable(Callable, ResilienceConfiguration)
or
executeSupplier(Supplier, ResilienceConfiguration)
, depending on the expected error
handling. Also consider the sibling methods featuring a fallback routine.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.@Nonnull public static <T> CompletableFuture<T> queueCallable(@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
- (Optional) In case of failure, execute this function.@Nonnull public static <T> CompletableFuture<T> queueCallable(@Nonnull Callable<T> callable, @Nonnull ResilienceConfiguration configuration)
T
- The return type of the call.callable
- The callable.configuration
- The configuration of the resilient call.@Nonnull public static <T> CompletableFuture<T> queueSupplier(@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
- (Optional) In case of failure, execute this function.@Nonnull public static <T> CompletableFuture<T> queueSupplier(@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 public static ResilienceDecorationStrategy getDecorationStrategy()
ResilienceDecorationStrategy
to be used to guarantee resilient function
properties.public static void setDecorationStrategy(@Nonnull ResilienceDecorationStrategy decorationStrategy)
ResilienceDecorationStrategy
to be used to guarantee resilient function
properties.Copyright © 2019 SAP SE. All rights reserved.