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
FieldsModifier and TypeFieldDescriptionstatic final SerializationHandle<TryConsumeCommand>static final TryConsumeCommand -
Method Summary
Modifier and TypeMethodDescriptionbooleancanBeMerged(RemoteCommand<?> another) static TryConsumeCommandcreate(long tokensToConsume) booleanequalsByContent(TryConsumeCommand other) longexecute(MutableBucketEntry mutableEntry, long currentTimeNanos) longgetConsumedTokens(Boolean result) longbooleanisImmediateSyncRequired(long unsynchronizedTokens, long nanosSinceLastSync) voidmergeInto(RemoteCommand<?> mergedCommand) 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, getMergedCommandsCount, isInitializationCommand, isMerged, unwrapOneResult
-
Field Details
-
TRY_CONSUME_ONE
-
SERIALIZATION_HANDLE
-
-
Method Details
-
toMergedCommand
- Specified by:
toMergedCommandin interfaceRemoteCommand<Boolean>
-
canBeMerged
- Specified by:
canBeMergedin interfaceRemoteCommand<Boolean>
-
mergeInto
- Specified by:
mergeIntoin interfaceRemoteCommand<Boolean>
-
create
-
execute
- Specified by:
executein interfaceRemoteCommand<Boolean>
-
getTokensToConsume
public long getTokensToConsume() -
getSerializationHandle
- Specified by:
getSerializationHandlein interfaceRemoteCommand<Boolean>
-
equalsByContent
- 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
- Specified by:
getConsumedTokensin interfaceRemoteCommand<Boolean>
-
getRequiredVersion
- Specified by:
getRequiredVersionin interfaceRemoteCommand<Boolean>
-