Class Resilience4jDecorationStrategy
java.lang.Object
com.sap.cloud.sdk.cloudplatform.resilience4j.Resilience4jDecorationStrategy
- All Implemented Interfaces:
ResilienceDecorationStrategy
Configurable implementation of ResilienceDecorationStrategy using Resilience4j.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder class for custom instances ofResilience4jDecorationStrategy
. -
Field Summary
Modifier and TypeFieldDescriptionprotected static final List<GenericDecorator>
Constant list of default decorators. -
Constructor Summary
ConstructorDescriptionDefault constructor with default set of decorators.Resilience4jDecorationStrategy
(GenericDecorator... decorators) Default constructor with enumerated decorators. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
protected boolean
void
clearAllCacheEntries
(ResilienceConfiguration configuration) Clears the entire cache associated with the givenResilienceConfiguration
if any exists, independent of the specifiedResilienceIsolationMode
and defined parameters.void
clearCache
(ResilienceConfiguration configuration) Clears the cache associated with the givenResilienceConfiguration
if any exists.void
clearCache
(ResilienceConfiguration configuration, CacheFilter filter) Clears the cache associated with the givenResilienceConfiguration
by respecting the providedCacheFilter
.<T> Callable<T>
decorateCallable
(Callable<T> callable, ResilienceConfiguration config, Function<? super Throwable, T> fallbackFunction) 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.boolean
int
hashCode()
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.sap.cloud.sdk.cloudplatform.resilience.ResilienceDecorationStrategy
decorateCallable, decorateSupplier, executeCallable, executeCallable, executeSupplier, executeSupplier, queueCallable, queueSupplier
-
Field Details
-
DEFAULT_DECORATORS
Constant list of default decorators.
-
-
Constructor Details
-
Resilience4jDecorationStrategy
public Resilience4jDecorationStrategy()Default constructor with default set of decorators. -
Resilience4jDecorationStrategy
Default constructor with enumerated decorators.- Parameters:
decorators
- The resilience decorators to be attached.
-
-
Method Details
-
clearCache
Description copied from interface:ResilienceDecorationStrategy
Clears the cache associated with the givenResilienceConfiguration
if any exists. This method respects tenant/principal isolation according to theResilienceIsolationMode
as well as parameter isolation.
To clear all cache entries for all tenants, principals, and parameters,ResilienceDecorationStrategy.clearAllCacheEntries(ResilienceConfiguration)
can be used instead.- Specified by:
clearCache
in interfaceResilienceDecorationStrategy
- Parameters:
configuration
- TheResilienceConfiguration
the cache is attached to.
-
clearCache
Description copied from interface:ResilienceDecorationStrategy
Clears the cache associated with the givenResilienceConfiguration
by respecting the providedCacheFilter
.- Specified by:
clearCache
in interfaceResilienceDecorationStrategy
- Parameters:
configuration
- TheResilienceConfiguration
the cache is attached to.filter
- ACacheFilter
to apply in order to select entries that should be cleared from the cache.
-
clearAllCacheEntries
Description copied from interface:ResilienceDecorationStrategy
Clears the entire cache associated with the givenResilienceConfiguration
if any exists, independent of the specifiedResilienceIsolationMode
and defined parameters. Be aware that this operation affects all tenants and principals.
UseResilienceDecorationStrategy.clearCache(ResilienceConfiguration)
to respect the tenant/principal and parameter isolation.- Specified by:
clearAllCacheEntries
in interfaceResilienceDecorationStrategy
- Parameters:
configuration
- TheResilienceConfiguration
the cache is attached to.
-
decorateSupplier
@Nonnull public <T> Supplier<T> decorateSupplier(@Nonnull Supplier<T> supplier, @Nonnull ResilienceConfiguration configuration, @Nullable Function<? super Throwable, T> fallbackFunction) Description copied from interface:ResilienceDecorationStrategy
Decorate an instance of a supplier function.- Specified by:
decorateSupplier
in interfaceResilienceDecorationStrategy
- Type Parameters:
T
- The return type of the call.- Parameters:
supplier
- The supplier.configuration
- The configuration of the resilient call.fallbackFunction
- In case of failure, execute this function.- Returns:
- A decorated supplier.
-
decorateCallable
@Nonnull public <T> Callable<T> decorateCallable(@Nonnull Callable<T> callable, @Nonnull ResilienceConfiguration config, @Nullable Function<? super Throwable, T> fallbackFunction) Description copied from interface:ResilienceDecorationStrategy
Decorate an instance of a callable function.- Specified by:
decorateCallable
in interfaceResilienceDecorationStrategy
- Type Parameters:
T
- The return type of the call.- Parameters:
callable
- The callable.config
- The configuration of the resilient call.fallbackFunction
- In case of failure, execute this function.- Returns:
- A decorated callable.
-
builder
@Nonnull public static Resilience4jDecorationStrategy.Resilience4jDecorationStrategyBuilder builder() -
toString
-
equals
-
canEqual
-
hashCode
public int hashCode()
-