Class TaskTokenBucketRateLimiter
java.lang.Object
com.cotani.task.throttle.TaskTokenBucketRateLimiter
- All Implemented Interfaces:
RateLimiter
-
Method Summary
Modifier and TypeMethodDescriptionstatic TaskTokenBucketRateLimiterstatic TaskTokenBucketRateLimiterReturns the suggested non-negative delay to wait before the nextRateLimiter.tryAcquire()attempt.boolean
-
Method Details
-
create
-
create
public static TaskTokenBucketRateLimiter create(long capacity, long refillTokens, Duration refillPeriod) -
tryAcquire
public boolean tryAcquire()- Specified by:
tryAcquirein interfaceRateLimiter
-
retryDelay
Description copied from interface:RateLimiterReturns the suggested non-negative delay to wait before the nextRateLimiter.tryAcquire()attempt. A zero duration means the caller may retry immediately.- Specified by:
retryDelayin interfaceRateLimiter
-