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
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for custom instances ofResilience4jDecorationStrategy. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final List<GenericDecorator>Constant list of default decorators. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor with default set of decorators.Resilience4jDecorationStrategy(GenericDecorator... decorators) Default constructor with enumerated decorators. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()protected booleanvoidclearAllCacheEntries(ResilienceConfiguration configuration) Clears the entire cache associated with the givenResilienceConfigurationif any exists, independent of the specifiedResilienceIsolationModeand defined parameters.voidclearCache(ResilienceConfiguration configuration) Clears the cache associated with the givenResilienceConfigurationif any exists.voidclearCache(ResilienceConfiguration configuration, CacheFilter filter) Clears the cache associated with the givenResilienceConfigurationby 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.booleaninthashCode()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:ResilienceDecorationStrategyClears the cache associated with the givenResilienceConfigurationif any exists. This method respects tenant/principal isolation according to theResilienceIsolationModeas well as parameter isolation.
To clear all cache entries for all tenants, principals, and parameters,ResilienceDecorationStrategy.clearAllCacheEntries(ResilienceConfiguration)can be used instead.- Specified by:
clearCachein interfaceResilienceDecorationStrategy- Parameters:
configuration- TheResilienceConfigurationthe cache is attached to.
-
clearCache
Description copied from interface:ResilienceDecorationStrategyClears the cache associated with the givenResilienceConfigurationby respecting the providedCacheFilter.- Specified by:
clearCachein interfaceResilienceDecorationStrategy- Parameters:
configuration- TheResilienceConfigurationthe cache is attached to.filter- ACacheFilterto apply in order to select entries that should be cleared from the cache.
-
clearAllCacheEntries
Description copied from interface:ResilienceDecorationStrategyClears the entire cache associated with the givenResilienceConfigurationif any exists, independent of the specifiedResilienceIsolationModeand 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:
clearAllCacheEntriesin interfaceResilienceDecorationStrategy- Parameters:
configuration- TheResilienceConfigurationthe 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:ResilienceDecorationStrategyDecorate an instance of a supplier function.- Specified by:
decorateSupplierin 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:ResilienceDecorationStrategyDecorate an instance of a callable function.- Specified by:
decorateCallablein 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()
-