Class SimpleBucketListener

java.lang.Object
io.github.bucket4j.SimpleBucketListener
All Implemented Interfaces:
BucketListener

public class SimpleBucketListener extends Object implements BucketListener
  • Constructor Details

    • SimpleBucketListener

      public SimpleBucketListener()
  • Method Details

    • onConsumed

      public void onConsumed(long tokens)
      Description copied from interface: BucketListener
      This method is called whenever tokens is consumed.
      Specified by:
      onConsumed in interface BucketListener
      Parameters:
      tokens - amount of tokens that consumed
    • onRejected

      public void onRejected(long tokens)
      Description copied from interface: BucketListener
      This method is called whenever consumption request for tokens is rejected.
      Specified by:
      onRejected in interface BucketListener
      Parameters:
      tokens - amount of tokens that rejected
    • onDelayed

      public void onDelayed(long nanos)
      Description copied from interface: BucketListener
      This method is called each time when delayed task was submit to ScheduledExecutorService because of wait for tokens refill in result of interaction with SchedulingBucket
      Specified by:
      onDelayed in interface BucketListener
      Parameters:
      nanos - amount of nanoseconds for which thread was parked
    • onParked

      public void onParked(long nanos)
      Description copied from interface: BucketListener
      This method is called each time when thread was parked for wait of tokens refill in result of interaction with BlockingBucket
      Specified by:
      onParked in interface BucketListener
      Parameters:
      nanos - amount of nanoseconds for which thread was parked
    • onInterrupted

      public void onInterrupted(InterruptedException e)
      Description copied from interface: BucketListener
      This method is called each time when thread was interrupted during the wait of tokens refill in result of interaction with BlockingBucket
      Specified by:
      onInterrupted in interface BucketListener
      Parameters:
      e - InterruptedException
    • getConsumed

      public long getConsumed()
    • getRejected

      public long getRejected()
    • getDelayedNanos

      public long getDelayedNanos()
    • getParkedNanos

      public long getParkedNanos()
    • getInterrupted

      public long getInterrupted()