public class Resilience4jDecorationStrategy extends Object implements ResilienceDecorationStrategy
Modifier and Type | Class and Description |
---|---|
static class |
Resilience4jDecorationStrategy.Resilience4jDecorationStrategyBuilder
Builder class for custom instances of
Resilience4jDecorationStrategy . |
Modifier and Type | Field and Description |
---|---|
protected static List<GenericDecorator> |
DEFAULT_DECORATORS
Constant list of default decorators.
|
DEFAULT_EXECUTOR_SERVICE, DEFAULT_THREAD_FACTORY, DEFAULT_THREAD_NAME_FORMAT
Constructor and Description |
---|
Resilience4jDecorationStrategy()
Default constructor with default set of decorators.
|
Resilience4jDecorationStrategy(GenericDecorator... decorators)
Default constructor with enumerated decorators.
|
Modifier and Type | Method and Description |
---|---|
static Resilience4jDecorationStrategy.Resilience4jDecorationStrategyBuilder |
builder() |
protected boolean |
canEqual(Object other) |
void |
clearAllCacheEntries(ResilienceConfiguration configuration)
Clears the entire cache associated with the given
ResilienceConfiguration if any exists, independent of
the specified ResilienceIsolationMode and defined parameters. |
void |
clearCache(ResilienceConfiguration configuration)
Clears the cache associated with the given
ResilienceConfiguration if any exists. |
<T> Callable<T> |
decorateCallable(Callable<T> callable,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate an instance of a callable function.
|
<T> Callable<T> |
decorateCallable(Callable<T> callable,
ResilienceConfiguration config,
Function<? super Throwable,T> fallbackFunction,
ExecutorService executor)
Decorate an instance of a callable function.
|
<T> Supplier<T> |
decorateSupplier(Supplier<T> supplier,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction)
Decorate an instance of a supplier function.
|
<T> Supplier<T> |
decorateSupplier(Supplier<T> supplier,
ResilienceConfiguration configuration,
Function<? super Throwable,T> fallbackFunction,
ExecutorService executor)
Decorate an instance of a supplier function.
|
boolean |
equals(Object o) |
int |
hashCode() |
void |
invalidateCache(ResilienceConfiguration configuration)
Deprecated.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
decorateCallable, decorateSupplier, executeCallable, executeCallable, executeSupplier, executeSupplier, queueCallable, queueSupplier
protected static final List<GenericDecorator> DEFAULT_DECORATORS
public Resilience4jDecorationStrategy()
public Resilience4jDecorationStrategy(@Nonnull GenericDecorator... decorators)
decorators
- The resilience decorators to be attached.@Deprecated public void invalidateCache(@Nonnull ResilienceConfiguration configuration)
ResilienceDecorationStrategy
ResilienceConfiguration
if any exists. Be aware that the cache
will be cleared for all tenants and principals.invalidateCache
in interface ResilienceDecorationStrategy
configuration
- The ResilienceConfiguration
the cache is attached to.@Beta public void clearCache(@Nonnull ResilienceConfiguration configuration)
ResilienceDecorationStrategy
ResilienceConfiguration
if any exists. This method respects
tenant/principal isolation according to the ResilienceIsolationMode
as well as parameter isolation.ResilienceDecorationStrategy.clearAllCacheEntries(ResilienceConfiguration)
can be used instead.clearCache
in interface ResilienceDecorationStrategy
configuration
- The ResilienceConfiguration
the cache is attached to.public void clearAllCacheEntries(@Nonnull ResilienceConfiguration configuration)
ResilienceDecorationStrategy
ResilienceConfiguration
if any exists, independent of
the specified ResilienceIsolationMode
and defined parameters. Be aware that this operation affects all
tenants and principals.ResilienceDecorationStrategy.clearCache(ResilienceConfiguration)
to respect the tenant/principal and parameter isolation.clearAllCacheEntries
in interface ResilienceDecorationStrategy
configuration
- The ResilienceConfiguration
the cache is attached to.@Nonnull public <T> Supplier<T> decorateSupplier(@Nonnull Supplier<T> supplier, @Nonnull ResilienceConfiguration configuration, @Nullable Function<? super Throwable,T> fallbackFunction)
ResilienceDecorationStrategy
decorateSupplier
in interface ResilienceDecorationStrategy
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 <T> Callable<T> decorateCallable(@Nonnull Callable<T> callable, @Nonnull ResilienceConfiguration configuration, @Nullable Function<? super Throwable,T> fallbackFunction)
ResilienceDecorationStrategy
decorateCallable
in interface ResilienceDecorationStrategy
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.@Nonnull public <T> Supplier<T> decorateSupplier(@Nonnull Supplier<T> supplier, @Nonnull ResilienceConfiguration configuration, @Nullable Function<? super Throwable,T> fallbackFunction, @Nullable ExecutorService executor)
ResilienceDecorationStrategy
decorateSupplier
in interface ResilienceDecorationStrategy
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.executor
- (Optional) The thread executor to manage potentially asynchronous properties with, e.g. time limiter.@Nonnull public <T> Callable<T> decorateCallable(@Nonnull Callable<T> callable, @Nonnull ResilienceConfiguration config, @Nullable Function<? super Throwable,T> fallbackFunction, @Nullable ExecutorService executor)
ResilienceDecorationStrategy
decorateCallable
in interface ResilienceDecorationStrategy
T
- The return type of the call.callable
- The callable.config
- The configuration of the resilient call.fallbackFunction
- In case of failure, execute this function.executor
- (Optional) The thread executor to manage potentially asynchronous properties with, e.g. time limiter.@Nonnull public static Resilience4jDecorationStrategy.Resilience4jDecorationStrategyBuilder builder()
Copyright © 2021 SAP SE. All rights reserved.