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
FieldsModifier and TypeFieldDescriptionstatic final SerializationHandle<ConsumeAsMuchAsPossibleCommand> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanlongexecute(MutableBucketEntry mutableEntry, long currentTimeNanos) longgetConsumedTokens(Long result) longgetLimit()intbooleanisImmediateSyncRequired(long unsynchronizedTokens, long nanosSinceLastSync) booleanisMerged()voidsetLimit(long limit) voidsetMerged(boolean merged) unwrapOneResult(Long consumedTokens, int indice) 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, isInitializationCommand, mergeInto, toMergedCommand
-
Field Details
-
SERIALIZATION_HANDLE
-
-
Constructor Details
-
ConsumeAsMuchAsPossibleCommand
public ConsumeAsMuchAsPossibleCommand(long limit)
-
-
Method Details
-
execute
- Specified by:
executein interfaceRemoteCommand<Long>
-
getLimit
public long getLimit() -
setLimit
public void setLimit(long limit) -
getSerializationHandle
- Specified by:
getSerializationHandlein interfaceRemoteCommand<Long>
-
equalsByContent
- 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
- Specified by:
getConsumedTokensin interfaceRemoteCommand<Long>
-
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
- Specified by:
unwrapOneResultin interfaceRemoteCommand<Long>
-
setMerged
public void setMerged(boolean merged)
-