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()VersiongetRequiredVersion()SerializationHandlegetSerializationHandle()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, isInitializationCommand
-
-
-
-
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()
-
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>
-
-