Class DefaultRateLimiterProvider
java.lang.Object
com.sap.cloud.sdk.cloudplatform.resilience4j.DefaultRateLimiterProvider
- All Implemented Interfaces:
GenericDecorator
,RateLimiterProvider
public class DefaultRateLimiterProvider
extends Object
implements RateLimiterProvider, GenericDecorator
Decorates a callable with a rate limiter based on a provided resilience configuration.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> Callable<T>
decorateCallable
(Callable<T> callable, ResilienceConfiguration configuration) Decorates the given callable to enable a resilient property.io.github.resilience4j.ratelimiter.RateLimiter
getRateLimiter
(ResilienceConfiguration configuration) Provides a rate limiter.
-
Constructor Details
-
DefaultRateLimiterProvider
public DefaultRateLimiterProvider()
-
-
Method Details
-
decorateCallable
@Nonnull public <T> Callable<T> decorateCallable(@Nonnull Callable<T> callable, @Nonnull ResilienceConfiguration configuration) Description copied from interface:GenericDecorator
Decorates the given callable to enable a resilient property.- Specified by:
decorateCallable
in interfaceGenericDecorator
- Type Parameters:
T
- The type of the callable.- Parameters:
callable
- The callable to decorate.configuration
- The configuration to be used.- Returns:
- The decorated callable.
-
getRateLimiter
@Nonnull public io.github.resilience4j.ratelimiter.RateLimiter getRateLimiter(@Nonnull ResilienceConfiguration configuration) Description copied from interface:RateLimiterProvider
Provides a rate limiter.- Specified by:
getRateLimiter
in interfaceRateLimiterProvider
- Parameters:
configuration
- The configuration for constructing the rate limiter.- Returns:
- A rate limiter.
-