java.lang.Object
io.github.bucket4j.SimpleBucketListener
- All Implemented Interfaces:
BucketListener
-
Field Summary
Fields inherited from interface io.github.bucket4j.BucketListener
NOPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlonglonglonglonglongvoidonConsumed(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 withSchedulingBucketvoidThis 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, waitMethods inherited from interface io.github.bucket4j.BucketListener
beforeParking
-
Constructor Details
-
SimpleBucketListener
public SimpleBucketListener()
-
-
Method Details
-
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
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()
-