Module io.github.bucket4j.core
Class EstimateAbilityToConsumeCommand
java.lang.Object
io.github.bucket4j.distributed.remote.commands.EstimateAbilityToConsumeCommand
- All Implemented Interfaces:
RemoteCommand<EstimationProbe>,ComparableByContent<EstimateAbilityToConsumeCommand>
public class EstimateAbilityToConsumeCommand
extends Object
implements RemoteCommand<EstimationProbe>, ComparableByContent<EstimateAbilityToConsumeCommand>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SerializationHandle<EstimateAbilityToConsumeCommand> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanlongexecute(MutableBucketEntry mutableEntry, long currentTimeNanos) longgetConsumedTokens(EstimationProbe result) longbooleanisImmediateSyncRequired(long unsynchronizedTokens, long nanosSinceLastSync) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.bucket4j.distributed.remote.RemoteCommand
asVerbose, canBeMerged, getMergedCommandsCount, isInitializationCommand, isMerged, mergeInto, toMergedCommand, unwrapOneResult
-
Field Details
-
SERIALIZATION_HANDLE
-
-
Constructor Details
-
EstimateAbilityToConsumeCommand
public EstimateAbilityToConsumeCommand(long tokensToEstimate)
-
-
Method Details
-
execute
public CommandResult<EstimationProbe> execute(MutableBucketEntry mutableEntry, long currentTimeNanos) - Specified by:
executein interfaceRemoteCommand<EstimationProbe>
-
getTokensToConsume
public long getTokensToConsume() -
getSerializationHandle
- Specified by:
getSerializationHandlein interfaceRemoteCommand<EstimationProbe>
-
equalsByContent
- Specified by:
equalsByContentin interfaceComparableByContent<EstimateAbilityToConsumeCommand>
-
isImmediateSyncRequired
public boolean isImmediateSyncRequired(long unsynchronizedTokens, long nanosSinceLastSync) - Specified by:
isImmediateSyncRequiredin interfaceRemoteCommand<EstimationProbe>
-
estimateTokensToConsume
public long estimateTokensToConsume()- Specified by:
estimateTokensToConsumein interfaceRemoteCommand<EstimationProbe>
-
getConsumedTokens
- Specified by:
getConsumedTokensin interfaceRemoteCommand<EstimationProbe>
-
getRequiredVersion
- Specified by:
getRequiredVersionin interfaceRemoteCommand<EstimationProbe>
-