Class RateGateBase

java.lang.Object
com.sportradar.livedata.sdk.common.rategate.RateGateBase
All Implemented Interfaces:
RateGate
Direct Known Subclasses:
CombinedRateGate, NullRateGate, SimpleRateGate

public abstract class RateGateBase extends Object implements RateGate
  • Field Details

  • Constructor Details

    • RateGateBase

      public RateGateBase()
  • Method Details

    • waitToProceed

      public void waitToProceed() throws InterruptedException
      Description copied from interface: RateGate
      Block when configured rate-limits are exceeded.
      Specified by:
      waitToProceed in interface RateGate
      Throws:
      InterruptedException - when somebody interrupted the waiting
    • waitToProceed

      public boolean waitToProceed(org.joda.time.Duration wait) throws InterruptedException
      Block when configured rate-limits are exceeded.
      Specified by:
      waitToProceed in interface RateGate
      Parameters:
      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
    • waitToProceed

      public abstract boolean waitToProceed(int amount, org.joda.time.Duration wait) throws InterruptedException
      Block when configured rate-limits are exceeded.
      Specified by:
      waitToProceed in interface RateGate
      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 occured
      Throws:
      InterruptedException - when somebody interrupted the waiting
    • howLongToWait

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

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

      public void setListener(RateGateListener listener)
      Set the event listener
      Specified by:
      setListener in interface RateGate
      Parameters:
      listener - - new listener