Module io.github.bucket4j.core
Interface Optimization
-
- All Known Implementing Classes:
BatchingOptimization,DelayOptimization,ManuallySyncingOptimization,PredictiveOptimization,SkipSyncOnZeroOptimization
public interface OptimizationSpecifies request optimization strategy forBucketProxyandAsyncBucketProxy. By default an interaction withBucketProxyandAsyncBucketProxyleads to immediately request to remote storage, various implementations ofOptimizationinterface can optimize this behavior.- See Also:
Optimizations,OptimizationListener
-
-
Field Summary
Fields Modifier and Type Field Description static OptimizationNONE_OPTIMIZED
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AsyncCommandExecutorapply(AsyncCommandExecutor originalExecutor)Decorates command executor in order to apply optimization strategy.CommandExecutorapply(CommandExecutor originalExecutor)Decorates command executor in order to apply optimization strategy.OptimizationwithListener(OptimizationListener listener)Specifies the listener for optimization events
-
-
-
Field Detail
-
NONE_OPTIMIZED
static final Optimization NONE_OPTIMIZED
-
-
Method Detail
-
withListener
Optimization withListener(OptimizationListener listener)
Specifies the listener for optimization events- Parameters:
listener- the listener for optimization events- Returns:
- the new instance of
Optimizationwith configured listener
-
apply
CommandExecutor apply(CommandExecutor originalExecutor)
Decorates command executor in order to apply optimization strategy.- Parameters:
originalExecutor- command executor that need to be optimized- Returns:
- decorated command executor
-
apply
AsyncCommandExecutor apply(AsyncCommandExecutor originalExecutor)
Decorates command executor in order to apply optimization strategy.- Parameters:
originalExecutor- command executor that need to be optimized- Returns:
- decorated command executor
-
-