- java.lang.Object
-
- io.github.bucket4j.SimpleBucketListener
-
- All Implemented Interfaces:
BucketListener
public class SimpleBucketListener extends Object implements BucketListener
-
-
Field Summary
-
Fields inherited from interface io.github.bucket4j.BucketListener
NOPE
-
-
Constructor Summary
Constructors Constructor Description SimpleBucketListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetConsumed()longgetDelayedNanos()longgetInterrupted()longgetParkedNanos()longgetRejected()voidonConsumed(long tokens)This method is called whenevertokensis consumed.voidonDelayed(long nanos)This method is called each time when delayed task was submit toScheduledExecutorServicebecause of wait for tokens refill in result of interaction withSchedulingBucketvoidonInterrupted(InterruptedException e)This method is called each time when thread was interrupted during the wait of tokens refill in result of interaction withBlockingBucketvoidonParked(long nanos)This method is called each time when thread was parked for wait of tokens refill in result of interaction withBlockingBucketvoidonRejected(long tokens)This method is called whenever consumption request fortokensis rejected.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.bucket4j.BucketListener
beforeParking
-
-
-
-
Method Detail
-
onConsumed
public void onConsumed(long tokens)
Description copied from interface:BucketListenerThis method is called whenevertokensis consumed.- Specified by:
onConsumedin interfaceBucketListener- Parameters:
tokens- amount of tokens that consumed
-
onRejected
public void onRejected(long tokens)
Description copied from interface:BucketListenerThis method is called whenever consumption request fortokensis rejected.- Specified by:
onRejectedin interfaceBucketListener- Parameters:
tokens- amount of tokens that rejected
-
onDelayed
public void onDelayed(long nanos)
Description copied from interface:BucketListenerThis method is called each time when delayed task was submit toScheduledExecutorServicebecause of wait for tokens refill in result of interaction withSchedulingBucket- Specified by:
onDelayedin interfaceBucketListener- Parameters:
nanos- amount of nanoseconds for which thread was parked
-
onParked
public void onParked(long nanos)
Description copied from interface:BucketListenerThis method is called each time when thread was parked for wait of tokens refill in result of interaction withBlockingBucket- Specified by:
onParkedin interfaceBucketListener- Parameters:
nanos- amount of nanoseconds for which thread was parked
-
onInterrupted
public void onInterrupted(InterruptedException e)
Description copied from interface:BucketListenerThis method is called each time when thread was interrupted during the wait of tokens refill in result of interaction withBlockingBucket- Specified by:
onInterruptedin interfaceBucketListener- Parameters:
e- InterruptedException
-
getConsumed
public long getConsumed()
-
getRejected
public long getRejected()
-
getDelayedNanos
public long getDelayedNanos()
-
getParkedNanos
public long getParkedNanos()
-
getInterrupted
public long getInterrupted()
-
-