Module io.github.bucket4j.core
Class TryConsumeCommand
- java.lang.Object
-
- io.github.bucket4j.distributed.remote.commands.TryConsumeCommand
-
- All Implemented Interfaces:
RemoteCommand<Boolean>,ComparableByContent<TryConsumeCommand>
public class TryConsumeCommand extends Object implements RemoteCommand<Boolean>, ComparableByContent<TryConsumeCommand>
-
-
Field Summary
Fields Modifier and Type Field Description static SerializationHandle<TryConsumeCommand>SERIALIZATION_HANDLEstatic TryConsumeCommandTRY_CONSUME_ONE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanBeMerged(RemoteCommand<?> another)static TryConsumeCommandcreate(long tokensToConsume)booleanequalsByContent(TryConsumeCommand other)longestimateTokensToConsume()CommandResult<Boolean>execute(MutableBucketEntry mutableEntry, long currentTimeNanos)longgetConsumedTokens(Boolean result)VersiongetRequiredVersion()SerializationHandlegetSerializationHandle()longgetTokensToConsume()booleanisImmediateSyncRequired(long unsynchronizedTokens, long nanosSinceLastSync)voidmergeInto(RemoteCommand<?> mergedCommand)RemoteCommand<?>toMergedCommand()-
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, getMergedCommandsCount, isInitializationCommand, isMerged, unwrapOneResult
-
-
-
-
Field Detail
-
TRY_CONSUME_ONE
public static final TryConsumeCommand TRY_CONSUME_ONE
-
SERIALIZATION_HANDLE
public static final SerializationHandle<TryConsumeCommand> SERIALIZATION_HANDLE
-
-
Method Detail
-
toMergedCommand
public RemoteCommand<?> toMergedCommand()
- Specified by:
toMergedCommandin interfaceRemoteCommand<Boolean>
-
canBeMerged
public boolean canBeMerged(RemoteCommand<?> another)
- Specified by:
canBeMergedin interfaceRemoteCommand<Boolean>
-
mergeInto
public void mergeInto(RemoteCommand<?> mergedCommand)
- Specified by:
mergeIntoin interfaceRemoteCommand<Boolean>
-
create
public static TryConsumeCommand create(long tokensToConsume)
-
execute
public CommandResult<Boolean> execute(MutableBucketEntry mutableEntry, long currentTimeNanos)
- Specified by:
executein interfaceRemoteCommand<Boolean>
-
getTokensToConsume
public long getTokensToConsume()
-
getSerializationHandle
public SerializationHandle getSerializationHandle()
- Specified by:
getSerializationHandlein interfaceRemoteCommand<Boolean>
-
equalsByContent
public boolean equalsByContent(TryConsumeCommand other)
- Specified by:
equalsByContentin interfaceComparableByContent<TryConsumeCommand>
-
isImmediateSyncRequired
public boolean isImmediateSyncRequired(long unsynchronizedTokens, long nanosSinceLastSync)- Specified by:
isImmediateSyncRequiredin interfaceRemoteCommand<Boolean>
-
estimateTokensToConsume
public long estimateTokensToConsume()
- Specified by:
estimateTokensToConsumein interfaceRemoteCommand<Boolean>
-
getConsumedTokens
public long getConsumedTokens(Boolean result)
- Specified by:
getConsumedTokensin interfaceRemoteCommand<Boolean>
-
getRequiredVersion
public Version getRequiredVersion()
- Specified by:
getRequiredVersionin interfaceRemoteCommand<Boolean>
-
-