Package org.jppf.scheduling
Class JPPFScheduleHandler
java.lang.Object
org.jppf.scheduling.JPPFScheduleHandler
This class handles a timer.
- Author:
- Laurent Cohen
-
Constructor Summary
ConstructorsConstructorDescriptionInitialize this schedule handler with a default name.JPPFScheduleHandler(String name) Initialize this schedule handler with the specified name. -
Method Summary
Modifier and TypeMethodDescriptionvoidcancelAction(Object key) Cancel the scheduled action identified by the specified key.voidcancelAction(Object key, boolean mayInterruptIfRunning) Cancel the scheduled action identified by the specified key.voidclear()Cleanup this schedule handler.voidclear(boolean shutdown) Shutdown this schedule handler.booleanDetermine whether an action is already regsitered for the specified job uuid.voidscheduleAction(Object key, JPPFSchedule schedule, Runnable action) Schedule an action.voidscheduleAction(Object key, JPPFSchedule schedule, Runnable action, long start) Schedule an action.
-
Constructor Details
-
JPPFScheduleHandler
public JPPFScheduleHandler()Initialize this schedule handler with a default name. -
JPPFScheduleHandler
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
Determine whether an action is already regsitered for the specified job uuid.- Parameters:
uuid- the uuid of a job to check.- Returns:
trueif an action is already scheduled for the job,falseotherwise.
-
cancelAction
Cancel the scheduled action identified by the specified key.- Parameters:
key- the key associated with the action.
-
cancelAction
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.
-