K - type of keypublic class GridBucket<K extends Serializable> extends AbstractBucket
INFINITY_DURATIONaddTokens, asAsync, asAsyncScheduler, asScheduler, asVerbose, consume, consumeIgnoringRateLimits, consumeUninterruptibly, estimateAbilityToConsume, forceAddTokens, replaceConfiguration, tryConsume, tryConsume, tryConsumeAndReturnRemaining, tryConsumeAsMuchAsPossible, tryConsumeAsMuchAsPossible, tryConsumeUninterruptiblyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconsume, consumeUninterruptibly, tryConsume, tryConsume, tryConsume, tryConsumeUninterruptibly, tryConsumeUninterruptibly, tryConsumeUninterruptiblypublic 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)
public Bucket toListenable(BucketListener listener)
Bucketlistener.
The created bucket will share same tokens with source bucket and vice versa.
See javadocs for BucketListener in order to understand semantic of listener.listener - the listener of bucket events.listenerpublic boolean isAsyncModeSupported()
BucketIf asynchronous mode is not supported any attempt to call Bucket.asAsync() will fail with UnsupportedOperationException
protected long consumeAsMuchAsPossibleImpl(long limit)
consumeAsMuchAsPossibleImpl in class AbstractBucketprotected CompletableFuture<Long> tryConsumeAsMuchAsPossibleAsyncImpl(long limit)
tryConsumeAsMuchAsPossibleAsyncImpl in class AbstractBucketprotected boolean tryConsumeImpl(long tokensToConsume)
tryConsumeImpl in class AbstractBucketprotected CompletableFuture<Boolean> tryConsumeAsyncImpl(long tokensToConsume)
tryConsumeAsyncImpl in class AbstractBucketprotected ConsumptionProbe tryConsumeAndReturnRemainingTokensImpl(long tokensToConsume)
tryConsumeAndReturnRemainingTokensImpl in class AbstractBucketprotected EstimationProbe estimateAbilityToConsumeImpl(long numTokens)
estimateAbilityToConsumeImpl in class AbstractBucketprotected CompletableFuture<ConsumptionProbe> tryConsumeAndReturnRemainingTokensAsyncImpl(long tokensToConsume)
tryConsumeAndReturnRemainingTokensAsyncImpl in class AbstractBucketprotected CompletableFuture<EstimationProbe> estimateAbilityToConsumeAsyncImpl(long tokensToEstimate)
estimateAbilityToConsumeAsyncImpl in class AbstractBucketprotected long reserveAndCalculateTimeToSleepImpl(long tokensToConsume,
long waitIfBusyNanosLimit)
reserveAndCalculateTimeToSleepImpl in class AbstractBucketprotected long consumeIgnoringRateLimitsImpl(long tokensToConsume)
consumeIgnoringRateLimitsImpl in class AbstractBucketprotected VerboseResult<Long> consumeAsMuchAsPossibleVerboseImpl(long limit)
consumeAsMuchAsPossibleVerboseImpl in class AbstractBucketprotected VerboseResult<Boolean> tryConsumeVerboseImpl(long tokensToConsume)
tryConsumeVerboseImpl in class AbstractBucketprotected VerboseResult<ConsumptionProbe> tryConsumeAndReturnRemainingTokensVerboseImpl(long tokensToConsume)
tryConsumeAndReturnRemainingTokensVerboseImpl in class AbstractBucketprotected VerboseResult<EstimationProbe> estimateAbilityToConsumeVerboseImpl(long numTokens)
estimateAbilityToConsumeVerboseImpl in class AbstractBucketprotected VerboseResult<Long> getAvailableTokensVerboseImpl()
getAvailableTokensVerboseImpl in class AbstractBucketprotected VerboseResult<Nothing> addTokensVerboseImpl(long tokensToAdd)
addTokensVerboseImpl in class AbstractBucketprotected VerboseResult<Nothing> forceAddTokensVerboseImpl(long tokensToAdd)
forceAddTokensVerboseImpl in class AbstractBucketprotected VerboseResult<Nothing> replaceConfigurationVerboseImpl(BucketConfiguration newConfiguration, TokensInheritanceStrategy tokensInheritanceStrategy)
replaceConfigurationVerboseImpl in class AbstractBucketprotected VerboseResult<Long> consumeIgnoringRateLimitsVerboseImpl(long tokensToConsume)
consumeIgnoringRateLimitsVerboseImpl in class AbstractBucketprotected CompletableFuture<Long> reserveAndCalculateTimeToSleepAsyncImpl(long tokensToConsume, long maxWaitTimeNanos)
reserveAndCalculateTimeToSleepAsyncImpl in class AbstractBucketprotected void addTokensImpl(long tokensToAdd)
addTokensImpl in class AbstractBucketprotected void forceAddTokensImpl(long tokensToAdd)
forceAddTokensImpl in class AbstractBucketprotected CompletableFuture<Void> addTokensAsyncImpl(long tokensToAdd)
addTokensAsyncImpl in class AbstractBucketprotected CompletableFuture<Void> forceAddTokensAsyncImpl(long tokensToAdd)
forceAddTokensAsyncImpl in class AbstractBucketprotected void replaceConfigurationImpl(BucketConfiguration newConfiguration, TokensInheritanceStrategy tokensInheritanceStrategy)
replaceConfigurationImpl in class AbstractBucketprotected CompletableFuture<Nothing> replaceConfigurationAsyncImpl(BucketConfiguration newConfiguration, TokensInheritanceStrategy tokensInheritanceStrategy)
replaceConfigurationAsyncImpl in class AbstractBucketprotected CompletableFuture<Long> consumeIgnoringRateLimitsAsyncImpl(long tokensToConsume)
consumeIgnoringRateLimitsAsyncImpl in class AbstractBucketprotected CompletableFuture<VerboseResult<Long>> tryConsumeAsMuchAsPossibleVerboseAsyncImpl(long limit)
tryConsumeAsMuchAsPossibleVerboseAsyncImpl in class AbstractBucketprotected CompletableFuture<VerboseResult<Boolean>> tryConsumeVerboseAsyncImpl(long tokensToConsume)
tryConsumeVerboseAsyncImpl in class AbstractBucketprotected CompletableFuture<VerboseResult<ConsumptionProbe>> tryConsumeAndReturnRemainingTokensVerboseAsyncImpl(long tokensToConsume)
tryConsumeAndReturnRemainingTokensVerboseAsyncImpl in class AbstractBucketprotected CompletableFuture<VerboseResult<EstimationProbe>> estimateAbilityToConsumeVerboseAsyncImpl(long tokensToEstimate)
estimateAbilityToConsumeVerboseAsyncImpl in class AbstractBucketprotected CompletableFuture<VerboseResult<Nothing>> addTokensVerboseAsyncImpl(long tokensToAdd)
addTokensVerboseAsyncImpl in class AbstractBucketprotected CompletableFuture<VerboseResult<Nothing>> forceAddTokensVerboseAsyncImpl(long tokensToAdd)
forceAddTokensVerboseAsyncImpl in class AbstractBucketprotected CompletableFuture<VerboseResult<Nothing>> replaceConfigurationVerboseAsyncImpl(BucketConfiguration newConfiguration, TokensInheritanceStrategy tokensInheritanceStrategy)
replaceConfigurationVerboseAsyncImpl in class AbstractBucketprotected CompletableFuture<VerboseResult<Long>> consumeIgnoringRateLimitsVerboseAsyncImpl(long tokensToConsume)
consumeIgnoringRateLimitsVerboseAsyncImpl 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, because available tokens can be changed by concurrent transactions for case of multithreaded/multi-process environment.
public BucketState createSnapshot()
BucketThis method is designed to be used only for monitoring and testing, you should never use this method for business cases.
Copyright © 2021. All rights reserved.