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 Type
    Method
    Description
    void
    forget(T item)
    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
    Resets the rate limiter.
    @NonNull Duration
    when(T item)
    Decides how long an item should wait before adding it back to the queue.
  • Method Details

    • when

      @NonNull @NonNull Duration when(@NonNull T item)
      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

      void forget(@NonNull T item)
      Indicates that an item is finished being retried (failed or succeeded).
      Parameters:
      item - an item to remove from internal tracking
    • numRequeues

      int numRequeues(@NonNull T item)
      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.