Class AvailabilityTask
java.lang.Object
org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask
- All Implemented Interfaces:
Runnable
Runnable task to cache and update the availability based on the
AvailabilityCommand.
NOTE: It is ideal to run this on a short interval (1 second) to maintain an accurate status of
the availability.- Author:
- kcwire
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAvailabilityTask(long interval, AvailabilityCommand command, String id) Default Constructor -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidrun()Determines if the interval has elapsed before executing theAvailabilityCommand.voidsetInterval(long interval) Sets the interval.voidupdateLastAvailableTimestamp(long timestamp) Update the timestamp based on last successful response.
-
Field Details
-
NO_DELAY
public static final int NO_DELAY- See Also:
-
ONE_SECOND
public static final int ONE_SECOND- See Also:
-
-
Constructor Details
-
AvailabilityTask
Default Constructor- Parameters:
interval- - in milliscommand- - the command to executeid- - the unique id
-
-
Method Details
-
run
public void run()Determines if the interval has elapsed before executing theAvailabilityCommand. It is ideal this task is run on short intervals to check if the interval has elapsed. -
isAvailable
public boolean isAvailable() -
updateLastAvailableTimestamp
public void updateLastAvailableTimestamp(long timestamp) Update the timestamp based on last successful response. This timestamp is used to determine if the interval has elapsed.- Parameters:
timestamp- - timestamp in millis
-
setInterval
public void setInterval(long interval) Sets the interval. This interval is used to determine if the Command should be executed.- Parameters:
interval- - interval in millis
-