Module io.github.bucket4j.core
Class ConsumeAsMuchAsPossibleCommand
- java.lang.Object
-
- io.github.bucket4j.distributed.remote.commands.ConsumeAsMuchAsPossibleCommand
-
- All Implemented Interfaces:
RemoteCommand<Long>,ComparableByContent<ConsumeAsMuchAsPossibleCommand>
public class ConsumeAsMuchAsPossibleCommand extends Object implements RemoteCommand<Long>, ComparableByContent<ConsumeAsMuchAsPossibleCommand>
-
-
Field Summary
Fields Modifier and Type Field Description static SerializationHandle<ConsumeAsMuchAsPossibleCommand>SERIALIZATION_HANDLE
-
Constructor Summary
Constructors Constructor Description ConsumeAsMuchAsPossibleCommand(long limit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequalsByContent(ConsumeAsMuchAsPossibleCommand other)longestimateTokensToConsume()CommandResult<Long>execute(MutableBucketEntry mutableEntry, long currentTimeNanos)longgetConsumedTokens(Long result)longgetLimit()intgetMergedCommandsCount()VersiongetRequiredVersion()SerializationHandlegetSerializationHandle()booleanisImmediateSyncRequired(long unsynchronizedTokens, long nanosSinceLastSync)booleanisMerged()voidsetLimit(long limit)voidsetMerged(boolean merged)CommandResult<?>unwrapOneResult(Long consumedTokens, int indice)-
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, isInitializationCommand, mergeInto, toMergedCommand
-
-
-
-
Field Detail
-
SERIALIZATION_HANDLE
public static final SerializationHandle<ConsumeAsMuchAsPossibleCommand> SERIALIZATION_HANDLE
-
-
Method Detail
-
execute
public CommandResult<Long> execute(MutableBucketEntry mutableEntry, long currentTimeNanos)
- Specified by:
executein interfaceRemoteCommand<Long>
-
getLimit
public long getLimit()
-
setLimit
public void setLimit(long limit)
-
getSerializationHandle
public SerializationHandle getSerializationHandle()
- Specified by:
getSerializationHandlein interfaceRemoteCommand<Long>
-
equalsByContent
public boolean equalsByContent(ConsumeAsMuchAsPossibleCommand other)
- Specified by:
equalsByContentin interfaceComparableByContent<ConsumeAsMuchAsPossibleCommand>
-
isImmediateSyncRequired
public boolean isImmediateSyncRequired(long unsynchronizedTokens, long nanosSinceLastSync)- Specified by:
isImmediateSyncRequiredin interfaceRemoteCommand<Long>
-
estimateTokensToConsume
public long estimateTokensToConsume()
- Specified by:
estimateTokensToConsumein interfaceRemoteCommand<Long>
-
getConsumedTokens
public long getConsumedTokens(Long result)
- Specified by:
getConsumedTokensin interfaceRemoteCommand<Long>
-
getRequiredVersion
public Version getRequiredVersion()
- Specified by:
getRequiredVersionin interfaceRemoteCommand<Long>
-
isMerged
public boolean isMerged()
- Specified by:
isMergedin interfaceRemoteCommand<Long>
-
getMergedCommandsCount
public int getMergedCommandsCount()
- Specified by:
getMergedCommandsCountin interfaceRemoteCommand<Long>
-
unwrapOneResult
public CommandResult<?> unwrapOneResult(Long consumedTokens, int indice)
- Specified by:
unwrapOneResultin interfaceRemoteCommand<Long>
-
setMerged
public void setMerged(boolean merged)
-
-