Class TokenBucketPool.TokenBucket

  • Enclosing class:

    public static class TokenBucketPool.TokenBucket
    extends java.lang.Object
    Single TokenBucket.
    • Constructor Summary

      Constructor Description
      TokenBucket​(long rate, long per)
      Create Token Bucket.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean consume()
      Consume token if available.
      • Methods inherited from class java.lang.Object

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

      • TokenBucket

        public TokenBucket​(long rate,
                           long per)
        Create Token Bucket.
        rate - amount of available tokens
        per - per nanosecond!
    • Method Detail

      • consume

        public boolean consume()
        Consume token if available.
        true if token was available.