|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--com.dvt.app.threadworks.Scheduler
A Java-based scheduler. Scheduler supports time-based dependencies and custom dependancies. Any task that is runnable can be scheduled.
Internally, Scheduler uses a TaskManager(@see TaskManager). Therefore, it benefits from the support infrastructure that TaskManager provides.
Only one Scheduler per JVM is allowed. If a custom environment for Scheduler is needed, place the Scheduler instantiation in the start-up sequence of your application BEFORE and Schedulers and TaskManagers are defined.
It is recommended, but not required, that scheduled tasks implement
Describable (@see com.dvt.app.common.Describable) as well as Runnable.
Describables are capable of producing textual descriptions of themselves. If
the task excepts or exceeds its maximum allowed run time, Scheduler will
log the probleem. If the task is Describable, Scheduler will log the tasks
description as well. This facilitates support.
Copyright: Delta Vortex Technologies, 2001.
Field Summary | |
static long |
DAILY_INTERVAL
Daily interval |
static int |
DEFAULT_DIAGNOSTIC_REPORTING_INTERVAL
Default interval for reporting diagnostics in milliseconds. |
static java.lang.String |
DEFAULT_LOG_LABEL
Default log label |
static int |
DEFAULT_MAX_TASK_TIME_ALLOWED
Default maximum time allowed on 1 task in milliseconds. |
static int |
DEFAULT_NBR_CONCURRENT_TASKS
Default number of concurrent scheduled tasks |
static java.lang.String |
DEFAULT_PROP_FILE_NAME
Default properties file name |
static long |
DEFAULT_SPIN_COUNT
Default spin count |
static long |
HOURLY_INTERVAL
Hourly Interval |
static long |
WEEKLY_INTERVAL
Weekly Interval |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
Scheduler(java.lang.String propertiesFileName)
Starts the Scheduler with a custom environment. |
|
Scheduler(TaskManagerEnvironment env,
long spinCount)
Starts the Scheduler with a custom environment. |
Method Summary | |
static void |
logDiagnostics()
Will log Scheduler diagnostics. |
static boolean |
remove(java.lang.Runnable task)
Removes a previously scheduled task |
static boolean |
remove(java.lang.Runnable task,
long interval)
Removes a previously scheduled task |
void |
run()
Used internally by the Scheduler. |
static void |
schedule(java.lang.Runnable task,
java.util.GregorianCalendar dateTime)
Schedules a one-time task execution starting at the specified date and time. |
static void |
schedule(java.lang.Runnable task,
java.util.GregorianCalendar dateTime,
DependencyEventListener listener)
Schedules a one-time task execution starting at the specified date and time. |
static void |
schedule(java.lang.Runnable task,
java.util.GregorianCalendar dateTime,
long interval)
Schedules a recurring task starting at the specified date and time. |
static void |
schedule(java.lang.Runnable task,
java.util.GregorianCalendar dateTime,
long interval,
DependencyEventListener listener)
Schedules a recurring task starting at the specified date and time. |
static void |
schedule(java.lang.Runnable task,
long delay)
Schedules a one-time execution of a task starting after an initial delay. |
static void |
schedule(java.lang.Runnable task,
long delay,
DependencyEventListener listener)
Schedules a one-time execution of a task starting after an initial delay. |
static void |
schedule(java.lang.Runnable task,
long delay,
long interval)
Schedules a recurring task starting after an initial delay. |
static void |
schedule(java.lang.Runnable task,
long delay,
long interval,
DependencyEventListener listener)
Schedules a recurring task starting after an initial delay. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final long DEFAULT_SPIN_COUNT
public static final java.lang.String DEFAULT_PROP_FILE_NAME
public static final int DEFAULT_NBR_CONCURRENT_TASKS
public static final int DEFAULT_DIAGNOSTIC_REPORTING_INTERVAL
public static final int DEFAULT_MAX_TASK_TIME_ALLOWED
public static final java.lang.String DEFAULT_LOG_LABEL
public static final long HOURLY_INTERVAL
public static final long DAILY_INTERVAL
public static final long WEEKLY_INTERVAL
Constructor Detail |
public Scheduler(java.lang.String propertiesFileName) throws ThreadWorksException
Properties
- public Scheduler(TaskManagerEnvironment env, long spinCount) throws ThreadWorksException
Environment
- for internal TaskManagertime
- interval in millis that the schedule is examined.Method Detail |
public void run()
run
in class java.lang.Thread
public static void schedule(java.lang.Runnable task, long delay) throws ThreadWorksException
task
- to be scheduledrun
- delay in millispublic static void schedule(java.lang.Runnable task, long delay, DependencyEventListener listener) throws ThreadWorksException
task
- to be scheduledrun
- delay in millisdependency
- listenerpublic static void schedule(java.lang.Runnable task, long delay, long interval) throws ThreadWorksException
task
- to be scheduledinitial
- run delay in millisrun
- interval used after initial runpublic static void schedule(java.lang.Runnable task, long delay, long interval, DependencyEventListener listener) throws ThreadWorksException
task
- to be scheduledinitial
- run delay in millisrun
- interval used after initial rundependency
- listenerpublic static void schedule(java.lang.Runnable task, java.util.GregorianCalendar dateTime) throws ThreadWorksException
task
- to be scheduleddate
- and time of initial runpublic static void schedule(java.lang.Runnable task, java.util.GregorianCalendar dateTime, DependencyEventListener listener) throws ThreadWorksException
task
- to be scheduleddate
- and time of initial rundependency
- listenerpublic static void schedule(java.lang.Runnable task, java.util.GregorianCalendar dateTime, long interval) throws ThreadWorksException
task
- to be scheduleddate
- and time of initial runrun
- interval used after initial runpublic static void schedule(java.lang.Runnable task, java.util.GregorianCalendar dateTime, long interval, DependencyEventListener listener) throws ThreadWorksException
task
- to be scheduleddate
- and time of initial runrun
- interval used after initial rundependency
- listenerpublic static boolean remove(java.lang.Runnable task) throws ThreadWorksException
task
- to be removedpublic static boolean remove(java.lang.Runnable task, long interval) throws ThreadWorksException
task
- to be removedinterval
- used in original schedulingpublic static void logDiagnostics() throws ThreadWorksException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |