Interface RateGate

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      org.joda.time.Duration howLongToWait()
      Approximately how long will I have to wait?
      org.joda.time.Duration howLongToWait​(int amount)
      Approximately how long will I have to wait?
      void setListener​(RateGateListener listener)
      Set the event listener
      void waitToProceed()
      Block when configured rate-limits are exceeded.
      void waitToProceed​(int amount)
      Block when configured rate-limits are exceeded.
      boolean waitToProceed​(int amount, org.joda.time.Duration wait)
      Block when configured rate-limits are exceeded.
      boolean waitToProceed​(org.joda.time.Duration wait)
      Block when configured rate-limits are exceeded.
    • Method Detail

      • waitToProceed

        boolean waitToProceed​(org.joda.time.Duration wait)
                       throws InterruptedException
        Block when configured rate-limits are exceeded.
        Parameters:
        wait - - the maximum amount of time to wait, negative means infinity
        Returns:
        true when we passed the gate; false when a timeout occurred
        Throws:
        InterruptedException - when somebody interrupted the waiting
      • waitToProceed

        void waitToProceed​(int amount)
                    throws InterruptedException
        Block when configured rate-limits are exceeded.
        Parameters:
        amount - - number of elements
        Throws:
        InterruptedException - when somebody interrupted the waiting
      • waitToProceed

        boolean waitToProceed​(int amount,
                              org.joda.time.Duration wait)
                       throws InterruptedException
        Block when configured rate-limits are exceeded.
        Parameters:
        amount - - number of elements
        wait - - the maximum amount of time to wait, negative means infinity
        Returns:
        true when we passed the gate; false when a timeout occurred
        Throws:
        InterruptedException - when somebody interrupted the waiting
      • howLongToWait

        org.joda.time.Duration howLongToWait()
        Approximately how long will I have to wait?
        Returns:
        - a non-negative amount of time, zero means no need to wait.
      • howLongToWait

        org.joda.time.Duration howLongToWait​(int amount)
        Approximately how long will I have to wait?
        Parameters:
        amount - - number of elements
        Returns:
        - a non-negative amount of time, zero means no need to wait.
      • setListener

        void setListener​(RateGateListener listener)
        Set the event listener
        Parameters:
        listener - - new listener