Module io.github.bucket4j.core
Package io.github.bucket4j.distributed
Interface OptimizationController
-
- All Known Implementing Classes:
DefaultBucketProxy
public interface OptimizationControllerThe optimization controller forBucketProxy.This interface is actual only if an optimization was applied during bucket construction via
RemoteBucketBuilder.withOptimization(Optimization)otherwise all methods of controller will do nothing.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidsyncByCondition(long unsynchronizedTokens, Duration timeSinceLastSync)Initiates immediate synchronization of local copy of bucket with remote storage in case of both conditions bellow aretrue: Accumulated amount of locally consumed tokens without external synchronization is greater than or equal tounsynchronizedTokensTime passed since last synchronization with external storage is greater than or equal totimeSinceLastSyncdefault voidsyncImmediately()Initiates immediate synchronization of local copy of bucket with remote storage
-
-
-
Method Detail
-
syncImmediately
default void syncImmediately()
Initiates immediate synchronization of local copy of bucket with remote storage
-
syncByCondition
void syncByCondition(long unsynchronizedTokens, Duration timeSinceLastSync)Initiates immediate synchronization of local copy of bucket with remote storage in case of both conditions bellow aretrue:- 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
- Parameters:
unsynchronizedTokens- criterion for accumulated amount of unsynchronized tokenstimeSinceLastSync- criterion for time passed since last synchronization
- Accumulated amount of locally consumed tokens without external synchronization is greater than or equal to
-
-