Interface RateLimiter<T>
- Type Parameters:
T
- item type
- All Known Implementing Classes:
BucketRateLimiter
,DefaultControllerRateLimiter
,ItemExponentialFailureRateLimiter
,ItemFastSlowRateLimiter
,MaxOfRateLimiter
public interface RateLimiter<T>
Interface for rate limiter implementations.
The code has been copied from the official client and modified: RateLimiter
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Indicates that an item is finished being retried (failed or succeeded).int
numRequeues
(T item) Returns a number of failures that the item has had.void
reset()
Resets the rate limiter.@NonNull Duration
Decides how long an item should wait before adding it back to the queue.
-
Method Details
-
when
Decides how long an item should wait before adding it back to the queue.- Parameters:
item
- an item that should wait- Returns:
- how long an item should wait before adding it back to the queue
-
forget
Indicates that an item is finished being retried (failed or succeeded).- Parameters:
item
- an item to remove from internal tracking
-
numRequeues
Returns a number of failures that the item has had.- Parameters:
item
- an item- Returns:
- number of failures that the item has had
-
reset
void reset()Resets the rate limiter.
-