public abstract class RateGateBase extends Object implements RateGate
Constructor and Description |
---|
RateGateBase() |
Modifier and Type | Method and Description |
---|---|
org.joda.time.Duration |
howLongToWait()
Approximately how long will I have to wait?
|
abstract 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.
|
boolean |
waitToProceed(org.joda.time.Duration wait)
Block when configured rate-limits are exceeded.
|
abstract boolean |
waitToProceed(int amount,
org.joda.time.Duration wait)
Block when configured rate-limits are exceeded.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
waitToProceed
public void waitToProceed() throws InterruptedException
RateGate
waitToProceed
in interface RateGate
InterruptedException
- when somebody interrupted the waitingpublic boolean waitToProceed(org.joda.time.Duration wait) throws InterruptedException
waitToProceed
in interface RateGate
wait
- - when specified this means the maximum amount of time to waitInterruptedException
- when somebody interrupted the waitingpublic abstract boolean waitToProceed(int amount, org.joda.time.Duration wait) throws InterruptedException
waitToProceed
in interface RateGate
amount
- - number of elementswait
- - the maximum amount of time to wait, negative means infinityInterruptedException
- when somebody interrupted the waitingpublic org.joda.time.Duration howLongToWait()
howLongToWait
in interface RateGate
public abstract org.joda.time.Duration howLongToWait(int amount)
howLongToWait
in interface RateGate
amount
- - number of elementspublic void setListener(RateGateListener listener)
setListener
in interface RateGate
listener
- - new listenerCopyright © 2013–2023. All rights reserved.