Class CombinedRateGate

    • Constructor Detail

      • CombinedRateGate

        public CombinedRateGate​(RateGate... rateGates)
        Constuct a combined rategate.
        Parameters:
        rateGates - array of RateGate to combine
      • CombinedRateGate

        public CombinedRateGate​(RateGate r1,
                                RateGate r2)
        Constuct a combined rategate.
        Parameters:
        r1 - - first rategate
        r2 - - second rategate
    • Method Detail

      • waitToProceed

        public boolean waitToProceed​(int amount,
                                     org.joda.time.Duration wait)
                              throws InterruptedException
        Block when configured rate-limits are exceeded.
        Specified by:
        waitToProceed in interface RateGate
        Specified by:
        waitToProceed in class RateGateBase
        Parameters:
        amount - - number of elements
        wait - - when specified this means the maximum amount of time to wait
        Returns:
        true when we passed the gate; false when a timeout occured
        Throws:
        InterruptedException - when somebody interrupted the waiting
      • howLongToWait

        public org.joda.time.Duration howLongToWait​(int amount)
        Approximately how long will I have to wait?
        Specified by:
        howLongToWait in interface RateGate
        Specified by:
        howLongToWait in class RateGateBase
        Parameters:
        amount - - number of elements
        Returns:
        - a non-negative amount of time, zero means no need to wait.