Interface RateGate
- All Known Implementing Classes:
CombinedRateGate,NullRateGate,RateGateBase,SimpleRateGate
public interface RateGate
-
Method Summary
Modifier and TypeMethodDescriptionorg.joda.time.DurationApproximately how long will I have to wait?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.voidwaitToProceed(int amount) Block when configured rate-limits are exceeded.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.
-
Method Details
-
waitToProceed
Block when configured rate-limits are exceeded.- Throws:
InterruptedException- when somebody interrupted the waiting
-
waitToProceed
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
Block when configured rate-limits are exceeded.- Parameters:
amount- - number of elements- Throws:
InterruptedException- when somebody interrupted the waiting
-
waitToProceed
Block when configured rate-limits are exceeded.- 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 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
Set the event listener- Parameters:
listener- - new listener
-