Interface RateLimiter
- All Known Implementing Classes:
AtomicRateLimiter
,SemaphoreBasedRateLimiter
public interface RateLimiter
A RateLimiter instance is thread-safe can be used to decorate multiple requests.
A RateLimiter distributes permits at a configurable rate. acquirePermission()
blocks if
necessary until a permit is available, and then takes it. Once acquired, permits need not be
released.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
An EventPublisher which can be used to register event consumers.static interface
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
Acquires a permission from this rate limiter, blocking until one is available, or the thread is interrupted.boolean
acquirePermission
(int permits) Acquires the given number of permits from this rate limiter, blocking until one is available, or the thread is interrupted.void
changeLimitForPeriod
(int limitForPeriod) Dynamic rate limiter configuration change.void
changeTimeoutDuration
(Duration timeoutDuration) Dynamic rate limiter configuration change.static <T> Callable<T>
decorateCallable
(RateLimiter rateLimiter, int permits, Callable<T> callable) Creates a callable which is restricted by a RateLimiter.static <T> Callable<T>
decorateCallable
(RateLimiter rateLimiter, Callable<T> callable) Creates a callable which is restricted by a RateLimiter.static <T,
R> io.github.resilience4j.core.functions.CheckedFunction<T, R> decorateCheckedFunction
(RateLimiter rateLimiter, int permits, io.github.resilience4j.core.functions.CheckedFunction<T, R> function) Creates a function which is restricted by a RateLimiter.static <T,
R> io.github.resilience4j.core.functions.CheckedFunction<T, R> decorateCheckedFunction
(RateLimiter rateLimiter, io.github.resilience4j.core.functions.CheckedFunction<T, R> function) Creates a function which is restricted by a RateLimiter.static <T,
R> io.github.resilience4j.core.functions.CheckedFunction<T, R> decorateCheckedFunction
(RateLimiter rateLimiter, Function<T, Integer> permitsCalculator, io.github.resilience4j.core.functions.CheckedFunction<T, R> function) Creates a function which is restricted by a RateLimiter.static io.github.resilience4j.core.functions.CheckedRunnable
decorateCheckedRunnable
(RateLimiter rateLimiter, int permits, io.github.resilience4j.core.functions.CheckedRunnable runnable) Creates a runnable which is restricted by a RateLimiter.static io.github.resilience4j.core.functions.CheckedRunnable
decorateCheckedRunnable
(RateLimiter rateLimiter, io.github.resilience4j.core.functions.CheckedRunnable runnable) Creates a runnable which is restricted by a RateLimiter.static <T> io.github.resilience4j.core.functions.CheckedSupplier<T>
decorateCheckedSupplier
(RateLimiter rateLimiter, int permits, io.github.resilience4j.core.functions.CheckedSupplier<T> supplier) Creates a supplier which is restricted by a RateLimiter.static <T> io.github.resilience4j.core.functions.CheckedSupplier<T>
decorateCheckedSupplier
(RateLimiter rateLimiter, io.github.resilience4j.core.functions.CheckedSupplier<T> supplier) Creates a supplier which is restricted by a RateLimiter.static <T> Supplier<CompletionStage<T>>
decorateCompletionStage
(RateLimiter rateLimiter, int permits, Supplier<CompletionStage<T>> supplier) Returns a supplier which is decorated by a rateLimiter.static <T> Supplier<CompletionStage<T>>
decorateCompletionStage
(RateLimiter rateLimiter, Supplier<CompletionStage<T>> supplier) Returns a supplier which is decorated by a rateLimiter.static <T> Consumer<T>
decorateConsumer
(RateLimiter rateLimiter, int permits, Consumer<T> consumer) Creates a consumer which is restricted by a RateLimiter.static <T> Consumer<T>
decorateConsumer
(RateLimiter rateLimiter, Consumer<T> consumer) Creates a consumer which is restricted by a RateLimiter.static <T> Consumer<T>
decorateConsumer
(RateLimiter rateLimiter, Function<T, Integer> permitsCalculator, Consumer<T> consumer) Creates a consumer which is restricted by a RateLimiter.static <T,
R> Function<T, R> decorateFunction
(RateLimiter rateLimiter, int permits, Function<T, R> function) Creates a function which is restricted by a RateLimiter.static <T,
R> Function<T, R> decorateFunction
(RateLimiter rateLimiter, Function<T, Integer> permitsCalculator, Function<T, R> function) Creates a function which is restricted by a RateLimiter.static <T,
R> Function<T, R> decorateFunction
(RateLimiter rateLimiter, Function<T, R> function) Creates a function which is restricted by a RateLimiter.decorateFuture
(RateLimiter rateLimiter, int permits, Supplier<? extends F> supplier) Returns a Supplier which is decorated by a RateLimiter.decorateFuture
(RateLimiter rateLimiter, Supplier<? extends F> supplier) Returns a Supplier which is decorated by a RateLimiter.static Runnable
decorateRunnable
(RateLimiter rateLimiter, int permits, Runnable runnable) Creates a runnable which is restricted by a RateLimiter.static Runnable
decorateRunnable
(RateLimiter rateLimiter, Runnable runnable) Creates a runnable which is restricted by a RateLimiter.static <T> Supplier<T>
decorateSupplier
(RateLimiter rateLimiter, int permits, Supplier<T> supplier) Creates a supplier which is restricted by a RateLimiter.static <T> Supplier<T>
decorateSupplier
(RateLimiter rateLimiter, Supplier<T> supplier) Creates a supplier which is restricted by a RateLimiter.default void
drainIfNeeded
(io.github.resilience4j.core.functions.Either<? extends Throwable, ?> callsResult) Deprecated.because of changing visibility to private in Java9+void
Drains all the permits left in the current period.default <T> T
executeCallable
(int permits, Callable<T> callable) Decorates and executes the decorated Callable.default <T> T
executeCallable
(Callable<T> callable) Decorates and executes the decorated Callable.default <T> T
executeCheckedSupplier
(int permits, io.github.resilience4j.core.functions.CheckedSupplier<T> checkedSupplier) Decorates and executes the decorated Supplier.default <T> T
executeCheckedSupplier
(io.github.resilience4j.core.functions.CheckedSupplier<T> checkedSupplier) Decorates and executes the decorated Supplier.default <T> CompletionStage<T>
executeCompletionStage
(Supplier<CompletionStage<T>> supplier) Decorates and executes the decorated CompletionStage.default void
executeRunnable
(int permits, Runnable runnable) Decorates and executes the decorated Runnable.default void
executeRunnable
(Runnable runnable) Decorates and executes the decorated Runnable.default <T> T
executeSupplier
(int permits, Supplier<T> supplier) Decorates and executes the decorated Supplier.default <T> T
executeSupplier
(Supplier<T> supplier) Decorates and executes the decorated Supplier.Returns an EventPublisher which can be used to register event consumers.Get the Metrics of this RateLimiter.getName()
Get the name of this RateLimiterGet the RateLimiterConfig of this RateLimiter.getTags()
Returns an unmodifiable map with tags assigned to this RateLimiter.static RateLimiter
of
(String name, RateLimiterConfig rateLimiterConfig) Creates a RateLimiter with a custom RateLimiter configuration.static RateLimiter
Creates a RateLimiter with a custom RateLimiter configuration.static RateLimiter
of
(String name, Supplier<RateLimiterConfig> rateLimiterConfigSupplier) Creates a RateLimiter with a custom RateLimiterConfig configuration.static RateLimiter
Creates a RateLimiter with a custom RateLimiterConfig configuration.static RateLimiter
ofDefaults
(String name) Creates a RateLimiter with a default RateLimiterConfig configuration.default void
Records a failed call.default void
This method must be invoked when a call returned a result and the result predicate should decide if the call was successful or not.default void
Records a successful call.default long
Reserves a permission from this rate limiter and returns nanoseconds you should wait for it.long
reservePermission
(int permits) Reserves the given number permits from this rate limiter and returns nanoseconds you should wait for it.static void
waitForPermission
(RateLimiter rateLimiter) Will wait for permission within default timeout duration.static void
waitForPermission
(RateLimiter rateLimiter, int permits) Will wait for required number of permits within default timeout duration.
-
Method Details
-
of
Creates a RateLimiter with a custom RateLimiter configuration.- Parameters:
name
- the name of the RateLimiterrateLimiterConfig
- a custom RateLimiter configuration- Returns:
- The
RateLimiter
-
of
Creates a RateLimiter with a custom RateLimiter configuration.- Parameters:
name
- the name of the RateLimiterrateLimiterConfig
- a custom RateLimiter configurationtags
- tags to assign to the RateLimiter- Returns:
- The
RateLimiter
-
of
Creates a RateLimiter with a custom RateLimiterConfig configuration.- Parameters:
name
- the name of the RateLimiterrateLimiterConfigSupplier
- a supplier of a custom RateLimiterConfig configuration- Returns:
- The
RateLimiter
-
of
static RateLimiter of(String name, Supplier<RateLimiterConfig> rateLimiterConfigSupplier, Map<String, String> tags) Creates a RateLimiter with a custom RateLimiterConfig configuration.- Parameters:
name
- the name of the RateLimiterrateLimiterConfigSupplier
- a supplier of a custom RateLimiterConfig configurationtags
- tags to assign to the RateLimiter- Returns:
- The
RateLimiter
-
ofDefaults
Creates a RateLimiter with a default RateLimiterConfig configuration.- Parameters:
name
- the name of the RateLimiter- Returns:
- The
RateLimiter
-
decorateCompletionStage
static <T> Supplier<CompletionStage<T>> decorateCompletionStage(RateLimiter rateLimiter, Supplier<CompletionStage<T>> supplier) Returns a supplier which is decorated by a rateLimiter.- Type Parameters:
T
- the type of the returned CompletionStage's result- Parameters:
rateLimiter
- the rateLimitersupplier
- the original supplier- Returns:
- a supplier which is decorated by a RateLimiter.
-
decorateCompletionStage
static <T> Supplier<CompletionStage<T>> decorateCompletionStage(RateLimiter rateLimiter, int permits, Supplier<CompletionStage<T>> supplier) Returns a supplier which is decorated by a rateLimiter.- Type Parameters:
T
- the type of the returned CompletionStage's result- Parameters:
rateLimiter
- the rateLimiterpermits
- number of permits that this call requiressupplier
- the original supplier- Returns:
- a supplier which is decorated by a RateLimiter.
-
decorateFuture
static <T,F extends Future<T>> Supplier<F> decorateFuture(RateLimiter rateLimiter, Supplier<? extends F> supplier) Returns a Supplier which is decorated by a RateLimiter.- Type Parameters:
T
- the type of the returned Future's resultF
- the return type of the original Supplier (extends Future<T>)- Parameters:
rateLimiter
- the rate limitersupplier
- the original supplier- Returns:
- a supplier which is decorated by a rate limiter.
-
decorateFuture
static <T,F extends Future<T>> Supplier<F> decorateFuture(RateLimiter rateLimiter, int permits, Supplier<? extends F> supplier) Returns a Supplier which is decorated by a RateLimiter.- Type Parameters:
T
- the type of the returned Future's resultF
- the return type of the original Supplier (extends Future<T>)- Parameters:
rateLimiter
- the rate limiterpermits
- the number of permits that this call requiressupplier
- the original supplier- Returns:
- a supplier which is decorated by a rate limiter.
-
decorateCheckedSupplier
static <T> io.github.resilience4j.core.functions.CheckedSupplier<T> decorateCheckedSupplier(RateLimiter rateLimiter, io.github.resilience4j.core.functions.CheckedSupplier<T> supplier) Creates a supplier which is restricted by a RateLimiter.- Type Parameters:
T
- the type of results supplied supplier- Parameters:
rateLimiter
- the RateLimitersupplier
- the original supplier- Returns:
- a supplier which is restricted by a RateLimiter.
-
decorateCheckedSupplier
static <T> io.github.resilience4j.core.functions.CheckedSupplier<T> decorateCheckedSupplier(RateLimiter rateLimiter, int permits, io.github.resilience4j.core.functions.CheckedSupplier<T> supplier) Creates a supplier which is restricted by a RateLimiter.- Type Parameters:
T
- the type of results supplied supplier- Parameters:
rateLimiter
- the RateLimiterpermits
- number of permits that this call requiressupplier
- the original supplier- Returns:
- a supplier which is restricted by a RateLimiter.
-
decorateCheckedRunnable
static io.github.resilience4j.core.functions.CheckedRunnable decorateCheckedRunnable(RateLimiter rateLimiter, io.github.resilience4j.core.functions.CheckedRunnable runnable) Creates a runnable which is restricted by a RateLimiter.- Parameters:
rateLimiter
- the RateLimiterrunnable
- the original runnable- Returns:
- a runnable which is restricted by a RateLimiter.
-
decorateCheckedRunnable
static io.github.resilience4j.core.functions.CheckedRunnable decorateCheckedRunnable(RateLimiter rateLimiter, int permits, io.github.resilience4j.core.functions.CheckedRunnable runnable) Creates a runnable which is restricted by a RateLimiter.- Parameters:
rateLimiter
- the RateLimiterpermits
- number of permits that this call requiresrunnable
- the original runnable- Returns:
- a runnable which is restricted by a RateLimiter.
-
decorateCheckedFunction
static <T,R> io.github.resilience4j.core.functions.CheckedFunction<T,R> decorateCheckedFunction(RateLimiter rateLimiter, io.github.resilience4j.core.functions.CheckedFunction<T, R> function) Creates a function which is restricted by a RateLimiter.- Type Parameters:
T
- the type of function argumentR
- the type of function results- Parameters:
rateLimiter
- the RateLimiterfunction
- the original function- Returns:
- a function which is restricted by a RateLimiter.
-
decorateCheckedFunction
static <T,R> io.github.resilience4j.core.functions.CheckedFunction<T,R> decorateCheckedFunction(RateLimiter rateLimiter, int permits, io.github.resilience4j.core.functions.CheckedFunction<T, R> function) Creates a function which is restricted by a RateLimiter.- Type Parameters:
T
- the type of function argumentR
- the type of function results- Parameters:
rateLimiter
- the RateLimiterpermits
- number of permits that this call requiresfunction
- the original function- Returns:
- a function which is restricted by a RateLimiter.
-
decorateCheckedFunction
static <T,R> io.github.resilience4j.core.functions.CheckedFunction<T,R> decorateCheckedFunction(RateLimiter rateLimiter, Function<T, Integer> permitsCalculator, io.github.resilience4j.core.functions.CheckedFunction<T, R> function) Creates a function which is restricted by a RateLimiter.- Type Parameters:
T
- the type of function argumentR
- the type of function results- Parameters:
rateLimiter
- the RateLimiterpermitsCalculator
- calculates the number of permits required by this call based on the functions argumentfunction
- the original function- Returns:
- a function which is restricted by a RateLimiter.
-
decorateSupplier
Creates a supplier which is restricted by a RateLimiter.- Type Parameters:
T
- the type of results supplied supplier- Parameters:
rateLimiter
- the RateLimitersupplier
- the original supplier- Returns:
- a supplier which is restricted by a RateLimiter.
-
decorateSupplier
Creates a supplier which is restricted by a RateLimiter.- Type Parameters:
T
- the type of results supplied supplier- Parameters:
rateLimiter
- the RateLimiterpermits
- number of permits that this call requiressupplier
- the original supplier- Returns:
- a supplier which is restricted by a RateLimiter.
-
decorateCallable
Creates a callable which is restricted by a RateLimiter.- Type Parameters:
T
- the type of results supplied by callable- Parameters:
rateLimiter
- the RateLimitercallable
- the original callable- Returns:
- a callable which is restricted by a RateLimiter.
-
decorateCallable
Creates a callable which is restricted by a RateLimiter.- Type Parameters:
T
- the type of results supplied by callable- Parameters:
rateLimiter
- the RateLimiterpermits
- number of permits that this call requirescallable
- the original callable- Returns:
- a callable which is restricted by a RateLimiter.
-
decorateConsumer
Creates a consumer which is restricted by a RateLimiter.- Type Parameters:
T
- the type of the input to the consumer- Parameters:
rateLimiter
- the RateLimiterconsumer
- the original consumer- Returns:
- a consumer which is restricted by a RateLimiter.
-
decorateConsumer
Creates a consumer which is restricted by a RateLimiter.- Type Parameters:
T
- the type of the input to the consumer- Parameters:
rateLimiter
- the RateLimiterpermits
- number of permits that this call requiresconsumer
- the original consumer- Returns:
- a consumer which is restricted by a RateLimiter.
-
decorateConsumer
static <T> Consumer<T> decorateConsumer(RateLimiter rateLimiter, Function<T, Integer> permitsCalculator, Consumer<T> consumer) Creates a consumer which is restricted by a RateLimiter.- Type Parameters:
T
- the type of the input to the consumer- Parameters:
rateLimiter
- the RateLimiterpermitsCalculator
- calculates the number of permits required by this call based on the functions argumentconsumer
- the original consumer- Returns:
- a consumer which is restricted by a RateLimiter.
-
decorateRunnable
Creates a runnable which is restricted by a RateLimiter.- Parameters:
rateLimiter
- the RateLimiterrunnable
- the original runnable- Returns:
- a runnable which is restricted by a RateLimiter.
-
decorateRunnable
Creates a runnable which is restricted by a RateLimiter.- Parameters:
rateLimiter
- the RateLimiterpermits
- number of permits that this call requiresrunnable
- the original runnable- Returns:
- a runnable which is restricted by a RateLimiter.
-
decorateFunction
Creates a function which is restricted by a RateLimiter.- Type Parameters:
T
- the type of the input to the functionR
- the type of the result of the function- Parameters:
rateLimiter
- the RateLimiterfunction
- the original function- Returns:
- a function which is restricted by a RateLimiter.
-
decorateFunction
static <T,R> Function<T,R> decorateFunction(RateLimiter rateLimiter, int permits, Function<T, R> function) Creates a function which is restricted by a RateLimiter.- Type Parameters:
T
- the type of the input to the functionR
- the type of the result of the function- Parameters:
rateLimiter
- the RateLimiterpermits
- number of permits that this call requiresfunction
- the original function- Returns:
- a function which is restricted by a RateLimiter.
-
decorateFunction
static <T,R> Function<T,R> decorateFunction(RateLimiter rateLimiter, Function<T, Integer> permitsCalculator, Function<T, R> function) Creates a function which is restricted by a RateLimiter.- Type Parameters:
T
- the type of the input to the functionR
- the type of the result of the function- Parameters:
rateLimiter
- the RateLimiterfunction
- the original functionpermitsCalculator
- calculates the number of permits required by this call based on the functions argument- Returns:
- a function which is restricted by a RateLimiter.
-
waitForPermission
Will wait for permission within default timeout duration.- Parameters:
rateLimiter
- the RateLimiter to get permission from- Throws:
RequestNotPermitted
- if waiting time elapsed before a permit was acquired.io.github.resilience4j.core.exception.AcquirePermissionCancelledException
- if thread was interrupted during permission wait
-
waitForPermission
Will wait for required number of permits within default timeout duration.- Parameters:
rateLimiter
- the RateLimiter to get permission frompermits
- number of permits we have to acquire- Throws:
RequestNotPermitted
- if waiting time elapsed before a permit was acquired.io.github.resilience4j.core.exception.AcquirePermissionCancelledException
- if thread was interrupted during permission wait
-
drainIfNeeded
@Deprecated default void drainIfNeeded(io.github.resilience4j.core.functions.Either<? extends Throwable, ?> callsResult) Deprecated.because of changing visibility to private in Java9+Will drain permits remaining in cycle if calls result meet the criteria defined inRateLimiterConfig.getDrainPermissionsOnResult()
.- Parameters:
callsResult
- result of a methods call that was rate limiter by this rate limiter
-
executeCompletionStage
Decorates and executes the decorated CompletionStage.- Type Parameters:
T
- the type of results supplied by this supplier- Parameters:
supplier
- the original CompletionStage- Returns:
- the decorated CompletionStage.
-
changeTimeoutDuration
Dynamic rate limiter configuration change. This method allows to change timeout duration of current limiter. NOTE! New timeout duration won't affect threads that are currently waiting for permission.- Parameters:
timeoutDuration
- new timeout duration
-
changeLimitForPeriod
void changeLimitForPeriod(int limitForPeriod) Dynamic rate limiter configuration change. This method allows to change count of permissions available during refresh period. NOTE! New limit won't affect current period permissions and will apply only from next one.- Parameters:
limitForPeriod
- new permissions limit
-
acquirePermission
default boolean acquirePermission()Acquires a permission from this rate limiter, blocking until one is available, or the thread is interrupted. Maximum wait time isRateLimiterConfig.getTimeoutDuration()
If the current thread is interrupted while waiting for a permit then it won't throw InterruptedException, but its interrupt status will be set.
- Returns:
true
if a permit was acquired andfalse
if waiting timeoutDuration elapsed before a permit was acquired
-
acquirePermission
boolean acquirePermission(int permits) Acquires the given number of permits from this rate limiter, blocking until one is available, or the thread is interrupted. Maximum wait time isRateLimiterConfig.getTimeoutDuration()
If the current thread is interrupted while waiting for a permit then it won't throw InterruptedException, but its interrupt status will be set.
- Parameters:
permits
- number of permits - use for systems where 1 call != 1 permit- Returns:
true
if a permit was acquired andfalse
if waiting timeoutDuration elapsed before a permit was acquired
-
reservePermission
default long reservePermission()Reserves a permission from this rate limiter and returns nanoseconds you should wait for it. If returned long is negative, it means that you failed to reserve permission, possibly yourRateLimiterConfig.getTimeoutDuration()
is less then time to wait for permission.- Returns:
long
amount of nanoseconds you should wait for reserved permissions. if negative, it means you failed to reserve.
-
reservePermission
long reservePermission(int permits) Reserves the given number permits from this rate limiter and returns nanoseconds you should wait for it. If returned long is negative, it means that you failed to reserve permission, possibly yourRateLimiterConfig.getTimeoutDuration()
is less then time to wait for permission.- Parameters:
permits
- number of permits - use for systems where 1 call != 1 permit- Returns:
long
amount of nanoseconds you should wait for reserved permissions. if negative, it means you failed to reserve.
-
drainPermissions
void drainPermissions()Drains all the permits left in the current period. -
onError
Records a failed call. This method must be invoked when a call failed.- Parameters:
throwable
- The throwable which must be recorded
-
onSuccess
default void onSuccess()Records a successful call. This method must be invoked when a call was successful. -
onResult
This method must be invoked when a call returned a result and the result predicate should decide if the call was successful or not.- Parameters:
result
- The result of the protected function
-
getName
String getName()Get the name of this RateLimiter- Returns:
- the name of this RateLimiter
-
getRateLimiterConfig
RateLimiterConfig getRateLimiterConfig()Get the RateLimiterConfig of this RateLimiter.- Returns:
- the RateLimiterConfig of this RateLimiter
-
getTags
Returns an unmodifiable map with tags assigned to this RateLimiter.- Returns:
- the tags assigned to this Retry in an unmodifiable map
-
getMetrics
RateLimiter.Metrics getMetrics()Get the Metrics of this RateLimiter.- Returns:
- the Metrics of this RateLimiter
-
getEventPublisher
RateLimiter.EventPublisher getEventPublisher()Returns an EventPublisher which can be used to register event consumers.- Returns:
- an EventPublisher
-
executeSupplier
Decorates and executes the decorated Supplier.- Type Parameters:
T
- the type of results supplied by this supplier- Parameters:
supplier
- the original Supplier- Returns:
- the result of the decorated Supplier.
-
executeSupplier
Decorates and executes the decorated Supplier.- Type Parameters:
T
- the type of results supplied by this supplier- Parameters:
permits
- number of permits that this call requiressupplier
- the original Supplier- Returns:
- the result of the decorated Supplier.
-
executeCallable
Decorates and executes the decorated Callable.- Type Parameters:
T
- the result type of callable- Parameters:
callable
- the original Callable- Returns:
- the result of the decorated Callable.
- Throws:
Exception
- if unable to compute a result
-
executeCallable
Decorates and executes the decorated Callable.- Type Parameters:
T
- the result type of callable- Parameters:
permits
- number of permits that this call requirescallable
- the original Callable- Returns:
- the result of the decorated Callable.
- Throws:
Exception
- if unable to compute a result
-
executeRunnable
Decorates and executes the decorated Runnable.- Parameters:
runnable
- the original Runnable
-
executeRunnable
Decorates and executes the decorated Runnable.- Parameters:
permits
- number of permits that this call requiresrunnable
- the original Runnable
-
executeCheckedSupplier
default <T> T executeCheckedSupplier(io.github.resilience4j.core.functions.CheckedSupplier<T> checkedSupplier) throws Throwable Decorates and executes the decorated Supplier.- Type Parameters:
T
- the type of results supplied by this supplier- Parameters:
checkedSupplier
- the original Supplier- Returns:
- the result of the decorated Supplier.
- Throws:
Throwable
- if something goes wrong applying this function to the given arguments
-
executeCheckedSupplier
default <T> T executeCheckedSupplier(int permits, io.github.resilience4j.core.functions.CheckedSupplier<T> checkedSupplier) throws Throwable Decorates and executes the decorated Supplier.- Type Parameters:
T
- the type of results supplied by this supplier- Parameters:
permits
- number of permits that this call requirescheckedSupplier
- the original Supplier- Returns:
- the result of the decorated Supplier.
- Throws:
Throwable
- if something goes wrong applying this function to the given arguments
-