java.lang.Object
io.github.bucket4j.EstimationProbe
- All Implemented Interfaces:
ComparableByContent<EstimationProbe>
Describes the estimation result.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbooleanFlag describes result of consumption operation.static EstimationProbecanBeConsumed(long remainingTokens) static EstimationProbecanNotBeConsumed(long remainingTokens, long nanosToWaitForRefill) booleanequalsByContent(EstimationProbe other) longReturns zero ifcanBeConsumed()returns true, else time in nanos which need to wait until requested amount of tokens will be refilledlongReturn the tokens remaining in the buckettoString()
-
Field Details
-
SERIALIZATION_HANDLE
-
-
Method Details
-
canBeConsumed
-
canNotBeConsumed
-
canBeConsumed
public boolean canBeConsumed()Flag describes result of consumption operation.- Returns:
- true if requested tokens can be consumed
-
getRemainingTokens
public long getRemainingTokens()Return the tokens remaining in the bucket- Returns:
- the tokens remaining in the bucket
-
getNanosToWaitForRefill
public long getNanosToWaitForRefill()Returns zero ifcanBeConsumed()returns true, else time in nanos which need to wait until requested amount of tokens will be refilled- Returns:
- Zero if
canBeConsumed()returns true, else time in nanos which need to wait until requested amount of tokens will be refilled
-
toString
-
equalsByContent
- Specified by:
equalsByContentin interfaceComparableByContent<EstimationProbe>
-