public class ScheduledTaskManager
extends java.lang.Object
implements java.io.Serializable
BaseStartup class) and adds the configured tasks to the
FIFO thread queue.BaseStartup class).| Modifier and Type | Field and Description |
|---|---|
private static java.util.ArrayList<ScheduledTask> |
cvScheduledTasks
The current set of scheduled tasks.
|
private static long |
serialVersionUID
The class' serialization version id.
|
| Constructor and Description |
|---|
ScheduledTaskManager() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
addToQueue(ScheduledTask task,
java.util.Date start,
long rerun)
Adds a scheduled task to the FIFO thread queue.
|
static boolean |
addToQueue(ScheduledTask task,
long start,
long rerun)
Adds a scheduled task to the FIFO thread queue.
|
private static java.util.Date |
calcAbsoluteTime(java.lang.String time)
Calculates and returns an absolute time value.
|
private static long |
calcRelativeTime(java.lang.String time)
Calculates and returns a relative time value.
|
static java.util.ArrayList<ScheduledTask> |
getTasks()
Returns the current set of scheduled tasks.
|
static boolean |
hasTasks()
Answers if any scheduled tasks are configured.
|
static void |
removeFromQueue(ScheduledTask task,
boolean cancel)
Removes a scheduled task from the FIFO thread queue.
|
static void |
removeFromQueue(java.lang.String id,
boolean cancel)
Removes a scheduled task from the FIFO thread queue.
|
static void |
startTasks()
Creates and schedules configured scheduled tasks for execution.
|
static void |
stopTasks()
Terminates scheduled tasks.
|
private static final long serialVersionUID
private static java.util.ArrayList<ScheduledTask> cvScheduledTasks
public static boolean addToQueue(ScheduledTask task, java.util.Date start, long rerun)
task - (ScheduledTask) The task to add.start - (Date) The date and time when the task should execute
for the first time.rerun - (long) The interval of time (milliseconds) that should
elapse between repeated executions of the task. A zero value
indicates no repeated execution.true if the task is successfully added to the
queue, otherwise false.public static boolean addToQueue(ScheduledTask task, long start, long rerun)
task - (ScheduledTask) The task to add.start - (long) The amount of time (milliseconds) the task should
wait before executing for the first time. A zero value indicates
immediate execution.rerun - (long) The interval of time (milliseconds) that should
elapse between repeated executions of the task. A zero value
indicates no repeated execution.true if the task is successfully added to the
queue, otherwise false.public static void removeFromQueue(ScheduledTask task, boolean cancel)
task - (ScheduledTask) The task to remove.cancel - (boolean) true if execution of the task
should be canceled, otherwise false.public static void removeFromQueue(java.lang.String id,
boolean cancel)
id - (String) The id of the task to remove.cancel - (boolean) true if execution of the task
should be canceled, otherwise false.public static java.util.ArrayList<ScheduledTask> getTasks()
public static boolean hasTasks()
true if tasks are configured, otherwise
false.public static void startTasks()
public static void stopTasks()
private static java.util.Date calcAbsoluteTime(java.lang.String time)
throws java.lang.Exception
time - (String) The time on which to base the absolute time.
The supplied value must be formatted as "hh:mm a".java.lang.Exceptionprivate static long calcRelativeTime(java.lang.String time)
throws java.lang.Exception
time - (String) The time on which to base the relative time.
The supplied value must be formatted as "hh:mm".java.lang.Exception