Class ConsumptionProbe

    • Method Detail

      • consumed

        public static ConsumptionProbe consumed​(long remainingTokens,
                                                long nanosToWaitForReset)
      • rejected

        public static ConsumptionProbe rejected​(long remainingTokens,
                                                long nanosToWaitForRefill,
                                                long nanosToWaitForReset)
      • isConsumed

        public boolean isConsumed()
        Flag describes result of consumption operation.
        Returns:
        true if tokens was 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 isConsumed() returns true, else time in nanos which need to wait until requested amount of tokens will be refilled
        Returns:
        Zero if isConsumed() returns true, else time in nanos which need to wait until requested amount of tokens will be refilled
      • getNanosToWaitForReset

        public long getNanosToWaitForReset()
        Time in nanos which need to wait until bucket will be fully refilled to its maximum
        Returns:
        time in nanos which need to wait until bucket will be fully refilled to its maximum