Class EstimationProbe

    • Method Detail

      • canBeConsumed

        public static EstimationProbe canBeConsumed​(long remainingTokens)
      • canNotBeConsumed

        public static EstimationProbe canNotBeConsumed​(long remainingTokens,
                                                       long nanosToWaitForRefill)
      • 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 if canBeConsumed() 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