Class RateLimiterStats

java.lang.Object
dev.failsafe.internal.RateLimiterStats
Direct Known Subclasses:
BurstyRateLimiterStats, SmoothRateLimiterStats

abstract class RateLimiterStats extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • acquirePermits

      abstract long acquirePermits(long permits, Duration maxWaitTime)
      Eagerly acquires permits and returns the time in nanos that must be waited in order to use the permits, else returns -1 if the wait time would exceed the maxWaitTime.
      Parameters:
      permits - the number of requested permits
      maxWaitTime - the max time to wait for the requested permits, else null to wait indefinitely
    • exceedsMaxWaitTime

      boolean exceedsMaxWaitTime(long waitNanos, Duration maxWaitTime)
      Returns whether the waitNanos would exceed the maxWaitTime, else false if maxWaitTime is null.
    • getElapsed

      Duration getElapsed()
      Returns the elapsed time since the rate limiter began.
    • reset

      abstract void reset()
      Resets the rate limiter's internal stats.