public interface BucketListener
Bucket.toListenable(BucketListener)
method.
SimpleBucketListener
Modifier and Type | Field and Description |
---|---|
static BucketListener |
NOPE
The default listener that do nothing.
|
Modifier and Type | Method and Description |
---|---|
void |
onConsumed(long tokens)
This method is called whenever
tokens is consumed. |
void |
onDelayed(long nanos)
This method is called each time when delayed task was submit to
ScheduledExecutorService because of wait for tokens refill
in result of interaction with AsyncScheduledBucket |
void |
onInterrupted(InterruptedException e)
This method is called each time when thread was interrupted during the wait of tokens refill
in result of interaction with
BlockingBucket |
void |
onParked(long nanos)
This method is called each time when thread was parked for wait of tokens refill
in result of interaction with
BlockingBucket |
void |
onRejected(long tokens)
This method is called whenever consumption request for
tokens is rejected. |
static final BucketListener NOPE
void onConsumed(long tokens)
tokens
is consumed.tokens
- amount of tokens that consumedvoid onRejected(long tokens)
tokens
is rejected.tokens
- amount of tokens that rejectedvoid onParked(long nanos)
BlockingBucket
nanos
- amount of nanoseconds for which thread was parkedvoid onInterrupted(InterruptedException e)
BlockingBucket
e
- InterruptedExceptionvoid onDelayed(long nanos)
ScheduledExecutorService
because of wait for tokens refill
in result of interaction with AsyncScheduledBucket
nanos
- amount of nanoseconds for which thread was parkedCopyright © 2019. All rights reserved.