Bucket.addTokens(long)
, follows the same semantic.Bucket.addTokens(long)
Bucket.addTokens(long)
ScheduledExecutorService
in case of lack of tokens.BucketProxy
.AbstractCompareAndSwapBasedProxyManager
typically performs in reaction to user request.AsyncBucketProxy
.ProxyManager
.AsyncBucketProxy
API.ClientSideConfig
with configured backwardCompatibilityVersion
.DefaultBucketProxy
found that bucket state has been lost,
and DefaultBucketProxy
is unable to repair bucket state or recovery strategy is RecoveryStrategy.THROW_BUCKET_NOT_FOUND_EXCEPTION
.AsyncBucketProxy
.RemoteAsyncBucketBuilder.build(Object, BucketConfiguration)
,
but additionally provides ability to provide configuration lazily, that can be helpful when figuring-out the right configuration parameters
is costly, for example because parameters for particular key
are stored in external database,
configurationSupplier
will be called if and only if bucket has not been persisted before.BucketProxy
.RemoteBucketBuilder.build(Object, BucketConfiguration)
,
but additionally provides ability to provide configuration lazily, that can be helpful when figuring-out the right configuration parameters
is costly, for example because parameters for particular key
are stored in external database,
configurationSupplier
will be called if and only if bucket has not been persisted before.RemoteAsyncBucketBuilder
ProxyManager
such as:
Backward compatibility version, see ClientSideConfig.backwardCompatibleWith(Version)
for more details.
Client-side clock, see ClientSideConfig.withClientClock(TimeMeter)
for more details.
BucketConfiguration
BlockingBucket.consume(long, BlockingStrategy)
tokens
from bucket ignoring all limits.Bucket.consumeIgnoringRateLimits(long)
, follows the same semantic.Bucket.consumeIgnoringRateLimits(long)
Bucket.consumeIgnoringRateLimits(long)
BlockingBucket.consume(long, BlockingStrategy)
but ignores interrupts(just restores interruption flag on exit).BlockingBucket.consumeUninterruptibly(long, UninterruptibleBlockingStrategy)
DefaultOptimizationListener
DelayOptimization
.DelayParameters
Bucket.estimateAbilityToConsume(long)
, follows the same semantic.Bucket.estimateAbilityToConsume(long)
Bucket.estimateAbilityToConsume(long)
SynchronizationStrategy.NONE
Bucket.forceAddTokens(long)
, follows the same semantic.Bucket.addTokens(long)
Bucket.forceAddTokens(long)
Bucket.getAvailableTokens()
Bucket.getAvailableTokens()
ConsumptionProbe.isConsumed()
returns true, else time in nanos which need to wait until requested amount of tokens will be refilledEstimationProbe.canBeConsumed()
returns true, else time in nanos which need to wait until requested amount of tokens will be refilledRefill
that does refill of tokens in greedy manner,
it will try to add the tokens to bucket as soon as possible.Refill
that does refill of tokens in intervally manner.Refill
that does refill of tokens in intervally manner.true
if implementation of clock behaves the similar way as System.currentTimeMillis()
,
in other words if implementation can be used as wall clock.LockFreeBucket
).AbstractLockBasedProxyManager
typically performs in reaction to user request.tokens
is consumed.ScheduledExecutorService
because of wait for tokens refill
in result of interaction with SchedulingBucket
BlockingBucket
BlockingBucket
tokens
is rejected.BucketProxy
and AsyncBucketProxy
.BucketProxy
.DelayOptimization
.Optimizations.predicting(DelayParameters, PredictionParameters)
but uses default PredictionParameters
.PredictiveOptimization
PredictionParameters
AsyncBucketProxy
BucketProxy
VerboseBucket
and AsyncVerboseBucket
.Bucket.replaceConfiguration(BucketConfiguration, TokensInheritanceStrategy)
Bucket.replaceConfiguration(BucketConfiguration, TokensInheritanceStrategy)
Bucket.replaceConfiguration(BucketConfiguration, TokensInheritanceStrategy)
Bucket
.true
:
Accumulated amount of locally consumed tokens without external synchronization is greater than or equal to unsynchronizedTokens
Time passed since last synchronization with external storage is greater than or equal to timeSinceLastSync
true
:
Accumulated amount of locally consumed tokens without external synchronization is greater than or equal to unsynchronizedTokens
Time passed since last synchronization with external storage is greater than or equal to timeSinceLastSync
TimeMeter
which works around System.currentTimeMillis()
TimeMeter
which works around System.nanoTime()
Bucket.replaceConfiguration(BucketConfiguration, TokensInheritanceStrategy)
happens.listener
.listener
.BlockingBucket.tryConsume(long, long, BlockingStrategy)
BlockingBucket.tryConsume(long, long, BlockingStrategy)
BlockingBucket.tryConsume(long, long, BlockingStrategy)
Bucket.tryConsume(long)
, follows the same semantic.Bucket.tryConsume(long)
SchedulingBucket.tryConsume(long, long, ScheduledExecutorService)
Bucket.tryConsume(long)
Bucket.tryConsumeAndReturnRemaining(long)
, follows the same semantic.Bucket.tryConsumeAndReturnRemaining(long)
Bucket.tryConsumeAndReturnRemaining(long)
limit
.Bucket.tryConsumeAsMuchAsPossible()
, follows the same semantic.Bucket.tryConsumeAsMuchAsPossible(long)
, follows the same semantic.Bucket.tryConsumeAsMuchAsPossible()
Bucket.tryConsumeAsMuchAsPossible(long)
Bucket.tryConsumeAsMuchAsPossible()
Bucket.tryConsumeAsMuchAsPossible(long)
BlockingBucket.tryConsume(long, long, BlockingStrategy)
but ignores interrupts(just restores interruption flag on exit).BlockingBucket.tryConsumeUninterruptibly(long, long, UninterruptibleBlockingStrategy)
BlockingBucket.tryConsumeUninterruptibly(long, long, UninterruptibleBlockingStrategy)
BlockingBucket.tryConsumeUninterruptibly(long, long, UninterruptibleBlockingStrategy)
Bucket
API.VerboseBucket
and AsyncVerboseBucket
.ClientSideConfig
with configured clientClock
.customTimeMeter
time meter for buckets that will be created by this builder.TimeMeter.SYSTEM_MILLISECONDS
as time meter for buckets that will be created by this builder.TimeMeter.SYSTEM_NANOTIME
as time meter for buckets that will be created by this builder.RecoveryStrategy.RECONSTRUCT
that is used by default.RecoveryStrategy.RECONSTRUCT
that is used by default.synchronizationStrategy
for buckets that will be created by this builder.Copyright © 2022. All rights reserved.