public class ConsumptionProbe extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static SerializationHandle<ConsumptionProbe> |
SERIALIZATION_HANDLE |
Modifier and Type | Method and Description |
---|---|
static ConsumptionProbe |
consumed(long remainingTokens) |
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 |
getRemainingTokens()
Return the tokens remaining in the bucket
|
boolean |
isConsumed()
Flag describes result of consumption operation.
|
static ConsumptionProbe |
rejected(long remainingTokens,
long nanosToWaitForRefill) |
String |
toString() |
public static final SerializationHandle<ConsumptionProbe> SERIALIZATION_HANDLE
public static ConsumptionProbe consumed(long remainingTokens)
public static ConsumptionProbe rejected(long remainingTokens, long nanosToWaitForRefill)
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 refilledCopyright © 2021. All rights reserved.