|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--com.perdues.Scheduler
Class to support periodic jobs passed to it as Runnables. This will run each one at fixed intervals given in seconds. Spawns a new Thread for each job it runs. This class's interface is based on com.bitmechanic.util.Scheduler, written by James Cooper.
If you would like to run a task once per minute, implemented by an instance of MyRunnable, you need only do:
Scheduler.defaultScheduler().scheduleJob(new MyRunnable(), 60);It will run in a new Thread every 60 seconds.
Field Summary | |
static boolean |
debug
Turn this flag on to receive debugging information on System.err. |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
Scheduler()
Creates but does not start a new Scheduler. |
Method Summary | |
static Scheduler |
defaultScheduler()
Returns the default Scheduler, creating and starting it if this has not already been done. |
int |
getJobCount()
Returns the number of periodic jobs currently managed by this Scheduler. |
void |
removeJob(java.lang.Runnable job)
Removes a periodic job from the list. |
void |
run()
Implementation of Runnable; not intended to be called directly from user code. |
void |
scheduleJob(java.lang.Runnable job,
int sleepInterval)
Adds a Runnable to this Scheduler, to be run every sleepInterval seconds. |
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 boolean debug
Constructor Detail |
public Scheduler()
Method Detail |
public static Scheduler defaultScheduler()
public void scheduleJob(java.lang.Runnable job, int sleepInterval)
public void removeJob(java.lang.Runnable job)
public void run()
run
in class java.lang.Thread
public int getJobCount()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |