Class JPPFScheduleHandler

java.lang.Object
org.jppf.scheduling.JPPFScheduleHandler

public class JPPFScheduleHandler extends Object
This class handles a timer.
Author:
Laurent Cohen
  • Constructor Details

    • JPPFScheduleHandler

      public JPPFScheduleHandler()
      Initialize this schedule handler with a default name.
    • JPPFScheduleHandler

      public JPPFScheduleHandler(String name)
      Initialize this schedule handler with the specified name.
      Parameters:
      name - the name given to this schedule handler.
  • Method Details

    • scheduleAction

      public void scheduleAction(Object key, JPPFSchedule schedule, Runnable action) throws ParseException
      Schedule an action.
      Parameters:
      key - key used to retrieve or cancel the action at a later time.
      schedule - the schedule at which the action is triggered.
      action - the action to perform when the schedule date is reached.
      Throws:
      ParseException - if the schedule date could not be parsed
    • scheduleAction

      public void scheduleAction(Object key, JPPFSchedule schedule, Runnable action, long start) throws ParseException
      Schedule an action.
      Parameters:
      key - key used to retrieve or cancel the action at a later time.
      schedule - the schedule at which the action is triggered.
      action - the action to perform when the schedule date is reached.
      start - the start time to use if the schedule is expressed as a duration.
      Throws:
      ParseException - if the schedule date could not be parsed
    • hasAction

      public boolean hasAction(String uuid)
      Determine whether an action is already regsitered for the specified job uuid.
      Parameters:
      uuid - the uuid of a job to check.
      Returns:
      true if an action is already scheduled for the job, false otherwise.
    • cancelAction

      public void cancelAction(Object key)
      Cancel the scheduled action identified by the specified key.
      Parameters:
      key - the key associated with the action.
    • cancelAction

      public void cancelAction(Object key, boolean mayInterruptIfRunning)
      Cancel the scheduled action identified by the specified key.
      Parameters:
      key - the key associated with the action.
      mayInterruptIfRunning - whether the thread that runs the task should be interrupted if the task is being executed.
    • clear

      public void clear()
      Cleanup this schedule handler.
    • clear

      public void clear(boolean shutdown)
      Shutdown this schedule handler.
      Parameters:
      shutdown - flag indicating whether this schedule handler should be shutdown.