Modifier and Type | Field and Description |
---|---|
private long |
delay
The delay (in ms) that should be introduced between two requests.
|
private long |
lastRequestTimeStamp
The time stamp (in ms) at which the last request has been finished.
|
Constructor and Description |
---|
StaticDelayer(long delay)
Constructor.
|
StaticDelayer(long delay,
long lastRequestTimeStamp)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
long |
getDelay()
Returns the delay (in ms) that this instance typically would introduce
between two consecutive requests.
|
void |
getRequestPermission()
Waits for the permission to perform a new request.
|
void |
requestFinished()
informs the Delayer instance about the finished request.
|
private long delay
private long lastRequestTimeStamp
public StaticDelayer(long delay)
delay
- the delay (in ms) that should be introduced between two requestspublic StaticDelayer(long delay, long lastRequestTimeStamp)
delay
- the delay (in ms) that should be introduced
between two requestslastRequestTimeStamp
- the time stamp (in ms) at which the last request
has been finishedpublic void getRequestPermission() throws InterruptedException
Delayer
getRequestPermission
in interface Delayer
InterruptedException
- if the internal waiting is interrupted.public void requestFinished()
Delayer
requestFinished
in interface Delayer
public long getDelay()
Delayer
Copyright © 2017–2020. All rights reserved.