public class AvailabilityTask extends Object implements Runnable
AvailabilityCommand.
NOTE: It is ideal to run this on a short interval (1 second) to maintain an accurate status of
the availability.| Modifier and Type | Field and Description |
|---|---|
static int |
NO_DELAY |
static int |
ONE_SECOND |
| Constructor and Description |
|---|
AvailabilityTask(long interval,
AvailabilityCommand command,
String id)
Default Constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isAvailable() |
void |
run()
Determines if the interval has elapsed before executing the
AvailabilityCommand. |
void |
setInterval(long interval)
Sets the interval.
|
void |
updateLastAvailableTimestamp(long timestamp)
Update the timestamp based on last successful response.
|
public static final int NO_DELAY
public static final int ONE_SECOND
public AvailabilityTask(long interval,
AvailabilityCommand command,
String id)
interval - - in milliscommand - - the command to executeid - - the unique idpublic void run()
AvailabilityCommand. It is
ideal this task is run on short intervals to check if the interval has elapsed.public boolean isAvailable()
public void updateLastAvailableTimestamp(long timestamp)
timestamp - - timestamp in millispublic void setInterval(long interval)
interval - - interval in millisThis work is licensed under a Creative Commons Attribution 4.0 International License.