public class SynchronizedBucket extends AbstractBucket
UNSPECIFIED_WAITING_LIMIT| Constructor and Description |
|---|
SynchronizedBucket(BucketConfiguration configuration) |
SynchronizedBucket(BucketConfiguration configuration,
Lock lock) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addTokensImpl(long tokensToAdd) |
protected long |
consumeAsMuchAsPossibleImpl(long limit) |
protected boolean |
consumeOrAwaitImpl(long tokensToConsume,
long waitIfBusyNanosLimit,
boolean uninterruptibly,
BlockingStrategy blockingStrategy) |
BucketState |
createSnapshot()
Creates the copy of internal state.
|
long |
getAvailableTokens()
Returns amount of available tokens in this bucket.
|
BucketConfiguration |
getConfiguration()
Returns configuration of this bucket.
|
String |
toString() |
protected ConsumptionProbe |
tryConsumeAndReturnRemainingTokensImpl(long tokensToConsume) |
protected boolean |
tryConsumeImpl(long tokensToConsume) |
addTokens, consume, consume, consumeUninterruptibly, consumeUninterruptibly, tryConsume, tryConsumeAndReturnRemaining, tryConsumeAsMuchAsPossible, tryConsumeAsMuchAsPossiblepublic SynchronizedBucket(BucketConfiguration configuration)
public SynchronizedBucket(BucketConfiguration configuration, Lock lock)
protected long consumeAsMuchAsPossibleImpl(long limit)
consumeAsMuchAsPossibleImpl in class AbstractBucketprotected boolean tryConsumeImpl(long tokensToConsume)
tryConsumeImpl in class AbstractBucketprotected ConsumptionProbe tryConsumeAndReturnRemainingTokensImpl(long tokensToConsume)
tryConsumeAndReturnRemainingTokensImpl in class AbstractBucketprotected boolean consumeOrAwaitImpl(long tokensToConsume,
long waitIfBusyNanosLimit,
boolean uninterruptibly,
BlockingStrategy blockingStrategy)
throws InterruptedException
consumeOrAwaitImpl in class AbstractBucketInterruptedExceptionprotected void addTokensImpl(long tokensToAdd)
addTokensImpl in class AbstractBucketpublic long getAvailableTokens()
BucketThis method designed to be used only for monitoring and testing, you should never use this method for business cases.
public BucketState createSnapshot()
BucketThis method is designed to be used only for monitoring and testing, you should never use this method for business cases.
public BucketConfiguration getConfiguration()
BucketCopyright © 2018. All rights reserved.