Class AvailabilityTask

java.lang.Object
org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask
All Implemented Interfaces:
Runnable

public class AvailabilityTask extends Object implements 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 Details

  • Constructor Details

    • AvailabilityTask

      public AvailabilityTask(long interval, AvailabilityCommand command, String id)
      Default Constructor
      Parameters:
      interval - - in millis
      command - - the command to execute
      id - - the unique id
  • Method Details

    • run

      public void run()
      Determines if the interval has elapsed before executing the AvailabilityCommand. It is ideal this task is run on short intervals to check if the interval has elapsed.
      Specified by:
      run in interface Runnable
    • 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