K - public class GridBucket<K extends Serializable> extends AbstractBucket
UNSPECIFIED_WAITING_LIMIT| 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) |
static <T extends Serializable> |
createInitializedBucket(T key,
BucketConfiguration configuration,
GridProxy<T> gridProxy,
RecoveryStrategy recoveryStrategy) |
static <T extends Serializable> |
createLazyBucket(T key,
Supplier<BucketConfiguration> configurationSupplier,
GridProxy<T> gridProxy) |
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.
|
protected ConsumptionProbe |
tryConsumeAndReturnRemainingTokensImpl(long tokensToConsume) |
protected boolean |
tryConsumeImpl(long tokensToConsume) |
addTokens, consume, consume, consumeUninterruptibly, consumeUninterruptibly, tryConsume, tryConsumeAndReturnRemaining, tryConsumeAsMuchAsPossible, tryConsumeAsMuchAsPossiblepublic static <T extends Serializable> GridBucket<T> createLazyBucket(T key, Supplier<BucketConfiguration> configurationSupplier, GridProxy<T> gridProxy)
public static <T extends Serializable> GridBucket<T> createInitializedBucket(T key, BucketConfiguration configuration, GridProxy<T> gridProxy, RecoveryStrategy recoveryStrategy)
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.