Package dev.failsafe
Class RateLimiterConfig<R>
java.lang.Object
dev.failsafe.PolicyConfig<R>
dev.failsafe.RateLimiterConfig<R>
- Type Parameters:
R
- result type
Configuration for a
RateLimiter
.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) long
(package private) Duration
(package private) Duration
(package private) Duration
Fields inherited from class dev.failsafe.PolicyConfig
failureListener, successListener
-
Constructor Summary
ConstructorsConstructorDescriptionRateLimiterConfig
(long maxPermits, Duration period) RateLimiterConfig
(RateLimiterConfig<R> config) RateLimiterConfig
(Duration maxRate) -
Method Summary
Modifier and TypeMethodDescriptionlong
For bursty rate limiters, returns the max permitted executions perperiod
, elsenull
if the rate limiter is not bursty.For smooth rate limiters, returns the max rate at which individual executions are permitted, elsenull
if the rate limiter is not smooth.Returns the max time to wait for permits to be available.For bursty rate limiters, returns the period after which permits are reset tomaxPermits
, elsenull
if the rate limiter is not bursty.Methods inherited from class dev.failsafe.PolicyConfig
getFailureListener, getSuccessListener
-
Field Details
-
Constructor Details
-
RateLimiterConfig
RateLimiterConfig(Duration maxRate) -
RateLimiterConfig
RateLimiterConfig(long maxPermits, Duration period) -
RateLimiterConfig
RateLimiterConfig(RateLimiterConfig<R> config)
-
-
Method Details
-
getMaxRate
For smooth rate limiters, returns the max rate at which individual executions are permitted, elsenull
if the rate limiter is not smooth.- See Also:
-
getMaxPermits
public long getMaxPermits()For bursty rate limiters, returns the max permitted executions perperiod
, elsenull
if the rate limiter is not bursty.- See Also:
-
getPeriod
For bursty rate limiters, returns the period after which permits are reset tomaxPermits
, elsenull
if the rate limiter is not bursty.- See Also:
-
getMaxWaitTime
Returns the max time to wait for permits to be available. If permits cannot be acquired before the max wait time is exceeded, then the rate limiter will throwRateLimitExceededException
.This setting only applies when the RateLimiter is used with the
Failsafe
class. It does not apply when the RateLimiter is used in a standalone way.- See Also:
-