-
- All Superinterfaces:
Bucket
- All Known Implementing Classes:
DefaultBucketProxy
public interface BucketProxy extends Bucket
Provides a light-weight proxy to bucket which state actually stored in external storage, like in-memory jvm or relational database.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description OptimizationControllergetOptimizationController()Returns optimization controller for this proxy.BucketProxytoListenable(BucketListener listener)Returns new copy of this bucket instance decorated bylistener.-
Methods inherited from interface io.github.bucket4j.Bucket
addTokens, asBlocking, asScheduler, asVerbose, consumeIgnoringRateLimits, estimateAbilityToConsume, forceAddTokens, getAvailableTokens, replaceConfiguration, reset, tryConsume, tryConsumeAndReturnRemaining, tryConsumeAsMuchAsPossible, tryConsumeAsMuchAsPossible
-
-
-
-
Method Detail
-
toListenable
BucketProxy toListenable(BucketListener listener)
Description copied from interface:BucketReturns new copy of this bucket instance decorated bylistener. The created bucket will share same tokens with source bucket and vice versa. See javadocs forBucketListenerin order to understand semantic of listener.- Specified by:
toListenablein interfaceBucket- Parameters:
listener- the listener of bucket events.- Returns:
- new bucket instance decorated by
listener
-
getOptimizationController
OptimizationController getOptimizationController()
Returns optimization controller for this proxy.This method is actual only if an optimization was applied during bucket construction via
RemoteBucketBuilder.withOptimization(Optimization)otherwise returned controller will do nothing.- Returns:
- optimization controller for this proxy
-
-