Class RateLimiterStats

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  RateLimiterStats.Stopwatch  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) 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 -1 if the wait time would exceed the maxWaitTime.
      (package private) boolean exceedsMaxWaitTime​(long waitNanos, java.time.Duration maxWaitTime)
      Returns whether the waitNanos would exceed the maxWaitTime, else false if maxWaitTime is null.
      (package private) java.time.Duration getElapsed()
      Returns the elapsed time since the rate limiter began.
      (package private) abstract void reset()
      Resets the rate limiter's internal stats.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 -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,
                                   java.time.Duration maxWaitTime)
        Returns whether the waitNanos would exceed the maxWaitTime, else false if maxWaitTime is 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.