public class ConsumptionProbe extends Object implements ComparableByContent<ConsumptionProbe>
Modifier and Type | Field and Description |
---|---|
static SerializationHandle<ConsumptionProbe> |
SERIALIZATION_HANDLE |
Modifier and Type | Method and Description |
---|---|
static ConsumptionProbe |
consumed(long remainingTokens,
long nanosToWaitForReset) |
boolean |
equalsByContent(ConsumptionProbe other) |
long |
getNanosToWaitForRefill()
Returns zero if
isConsumed() returns true, else time in nanos which need to wait until requested amount of tokens will be refilled |
long |
getNanosToWaitForReset()
Time in nanos which need to wait until bucket will be fully refilled to its maximum
|
long |
getRemainingTokens()
Return the tokens remaining in the bucket
|
boolean |
isConsumed()
Flag describes result of consumption operation.
|
static ConsumptionProbe |
rejected(long remainingTokens,
long nanosToWaitForRefill,
long nanosToWaitForReset) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
equals
public static final SerializationHandle<ConsumptionProbe> SERIALIZATION_HANDLE
public static ConsumptionProbe consumed(long remainingTokens, long nanosToWaitForReset)
public static ConsumptionProbe rejected(long remainingTokens, long nanosToWaitForRefill, long nanosToWaitForReset)
public boolean isConsumed()
public long getRemainingTokens()
public long getNanosToWaitForRefill()
isConsumed()
returns true, else time in nanos which need to wait until requested amount of tokens will be refilledisConsumed()
returns true, else time in nanos which need to wait until requested amount of tokens will be refilledpublic long getNanosToWaitForReset()
public boolean equalsByContent(ConsumptionProbe other)
equalsByContent
in interface ComparableByContent<ConsumptionProbe>
Copyright © 2020. All rights reserved.