Module io.github.bucket4j.core
Class TryConsumeAndReturnRemainingTokensCommand
- java.lang.Object
-
- io.github.bucket4j.distributed.remote.commands.TryConsumeAndReturnRemainingTokensCommand
-
- All Implemented Interfaces:
RemoteCommand<ConsumptionProbe>,ComparableByContent<TryConsumeAndReturnRemainingTokensCommand>
public class TryConsumeAndReturnRemainingTokensCommand extends Object implements RemoteCommand<ConsumptionProbe>, ComparableByContent<TryConsumeAndReturnRemainingTokensCommand>
-
-
Field Summary
Fields Modifier and Type Field Description static SerializationHandle<TryConsumeAndReturnRemainingTokensCommand>SERIALIZATION_HANDLE
-
Constructor Summary
Constructors Constructor Description TryConsumeAndReturnRemainingTokensCommand(long tokensToConsume)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequalsByContent(TryConsumeAndReturnRemainingTokensCommand other)longestimateTokensToConsume()CommandResult<ConsumptionProbe>execute(MutableBucketEntry mutableEntry, long currentTimeNanos)longgetConsumedTokens(ConsumptionProbe result)VersiongetRequiredVersion()SerializationHandlegetSerializationHandle()longgetTokensToConsume()booleanisImmediateSyncRequired(long unsynchronizedTokens, long nanosSinceLastSync)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.bucket4j.distributed.remote.RemoteCommand
asVerbose, canBeMerged, getMergedCommandsCount, isInitializationCommand, isMerged, mergeInto, toMergedCommand, unwrapOneResult
-
-
-
-
Field Detail
-
SERIALIZATION_HANDLE
public static final SerializationHandle<TryConsumeAndReturnRemainingTokensCommand> SERIALIZATION_HANDLE
-
-
Method Detail
-
execute
public CommandResult<ConsumptionProbe> execute(MutableBucketEntry mutableEntry, long currentTimeNanos)
- Specified by:
executein interfaceRemoteCommand<ConsumptionProbe>
-
getTokensToConsume
public long getTokensToConsume()
-
getSerializationHandle
public SerializationHandle getSerializationHandle()
- Specified by:
getSerializationHandlein interfaceRemoteCommand<ConsumptionProbe>
-
equalsByContent
public boolean equalsByContent(TryConsumeAndReturnRemainingTokensCommand other)
- Specified by:
equalsByContentin interfaceComparableByContent<TryConsumeAndReturnRemainingTokensCommand>
-
isImmediateSyncRequired
public boolean isImmediateSyncRequired(long unsynchronizedTokens, long nanosSinceLastSync)- Specified by:
isImmediateSyncRequiredin interfaceRemoteCommand<ConsumptionProbe>
-
estimateTokensToConsume
public long estimateTokensToConsume()
- Specified by:
estimateTokensToConsumein interfaceRemoteCommand<ConsumptionProbe>
-
getConsumedTokens
public long getConsumedTokens(ConsumptionProbe result)
- Specified by:
getConsumedTokensin interfaceRemoteCommand<ConsumptionProbe>
-
getRequiredVersion
public Version getRequiredVersion()
- Specified by:
getRequiredVersionin interfaceRemoteCommand<ConsumptionProbe>
-
-