Package net.devslash

Class AcquiringRateLimiter

  • All Implemented Interfaces:

    
    public final class AcquiringRateLimiter
    
                        

    This rate limiter isn't perfect but aims to ensure the rate isn't going too fast, and that the rate is smooth. This means that calls to acquire will only unblock one at a time. If two concurrent calls are made to acquire, then the first will unblock straight away. The second one will unblock after 1 / QPS seconds.

    This means that the rate limiter effectively has no memory of the past, beyond the call before. This means that if there is inconsistency with how fast requests are performed, then the rate limit may be over-restrictive.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Unit acquire()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AcquiringRateLimiter

        AcquiringRateLimiter(RateLimitOptions rateLimitOptions, Clock clock)