Class RateGateBase
java.lang.Object
com.sportradar.livedata.sdk.common.rategate.RateGateBase
- All Implemented Interfaces:
RateGate
- Direct Known Subclasses:
CombinedRateGate,NullRateGate,SimpleRateGate
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.joda.time.DurationApproximately how long will I have to wait?abstract org.joda.time.DurationhowLongToWait(int amount) Approximately how long will I have to wait?voidsetListener(RateGateListener listener) Set the event listenervoidBlock when configured rate-limits are exceeded.abstract booleanwaitToProceed(int amount, org.joda.time.Duration wait) Block when configured rate-limits are exceeded.booleanwaitToProceed(org.joda.time.Duration wait) Block when configured rate-limits are exceeded.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.sportradar.livedata.sdk.common.rategate.RateGate
waitToProceed
-
Field Details
-
listenerLock
-
listener
-
-
Constructor Details
-
RateGateBase
public RateGateBase()
-
-
Method Details
-
waitToProceed
Description copied from interface:RateGateBlock when configured rate-limits are exceeded.- Specified by:
waitToProceedin interfaceRateGate- Throws:
InterruptedException- when somebody interrupted the waiting
-
waitToProceed
Block when configured rate-limits are exceeded.- Specified by:
waitToProceedin interfaceRateGate- 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:
waitToProceedin interfaceRateGate- Parameters:
amount- - number of elementswait- - 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:
howLongToWaitin interfaceRateGate- 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:
howLongToWaitin interfaceRateGate- Parameters:
amount- - number of elements- Returns:
- - a non-negative amount of time, zero means no need to wait.
-
setListener
Set the event listener- Specified by:
setListenerin interfaceRateGate- Parameters:
listener- - new listener
-