Package dev.failsafe.internal
Class RateLimiterStats
- java.lang.Object
-
- dev.failsafe.internal.RateLimiterStats
-
- Direct Known Subclasses:
BurstyRateLimiterStats,SmoothRateLimiterStats
abstract class RateLimiterStats extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classRateLimiterStats.Stopwatch
-
Field Summary
Fields Modifier and Type Field Description (package private) RateLimiterStats.Stopwatchstopwatch
-
Constructor Summary
Constructors Constructor Description RateLimiterStats(RateLimiterStats.Stopwatch stopwatch)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract longacquirePermits(long permits, java.time.Duration maxWaitTime)Eagerly acquires permits and returns the time in nanos that must be waited in order to use the permits, else returns-1if the wait time would exceed themaxWaitTime.(package private) booleanexceedsMaxWaitTime(long waitNanos, java.time.Duration maxWaitTime)Returns whether thewaitNanoswould exceed themaxWaitTime, elsefalseifmaxWaitTimeis null.(package private) java.time.DurationgetElapsed()Returns the elapsed time since the rate limiter began.(package private) abstract voidreset()Resets the rate limiter's internal stats.
-
-
-
Field Detail
-
stopwatch
final RateLimiterStats.Stopwatch stopwatch
-
-
Constructor Detail
-
RateLimiterStats
RateLimiterStats(RateLimiterStats.Stopwatch stopwatch)
-
-
Method Detail
-
acquirePermits
abstract long acquirePermits(long permits, java.time.Duration maxWaitTime)Eagerly acquires permits and returns the time in nanos that must be waited in order to use the permits, else returns-1if the wait time would exceed themaxWaitTime.- Parameters:
permits- the number of requested permitsmaxWaitTime- the max time to wait for the requested permits, elsenullto wait indefinitely
-
exceedsMaxWaitTime
boolean exceedsMaxWaitTime(long waitNanos, java.time.Duration maxWaitTime)Returns whether thewaitNanoswould exceed themaxWaitTime, elsefalseifmaxWaitTimeis null.
-
getElapsed
java.time.Duration getElapsed()
Returns the elapsed time since the rate limiter began.
-
reset
abstract void reset()
Resets the rate limiter's internal stats.
-
-