|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--javatools.cron.CronThread
Crontab uses this class as its method for executing a process. ThreadGroup is the threadgroup to execute this thread in. Since Crontab will execute everything in the one ThreadGroup this provides a method for getting all the processes that are active if so desired. The class to be executed can be in one of two forms. First thing we check is if the class has a static main method. If so it is executed and the arguments are passed to main. If there is no main() we check that the class implements Runnable. If so we create an instance and pass the args to the constructor. If the constructor doesn't accept arguments we call the default constructor and the arguments are lost. If the class has no main() and is not Runnable, then then a class cast exception is thrown.
Should you wish your threads to be executed at a different priority, feel free to have your tasks accept one of the arguments to be the priority and call Thread.currentThread().setPriority(). If you would like a standard handling of this, feel free to inherit CrontabEntry and override execute() to, for example, have the first argument always be the priority. I don't want to set a policy for this. I'll let the users do that.
Field Summary | |
(package private) java.lang.String[] |
args
|
(package private) java.lang.String |
className
|
(package private) java.lang.Runnable |
runnable
|
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
CronThread(java.lang.ThreadGroup threadGroup,
java.lang.String className,
java.lang.String[] args)
|
Method Summary | |
void |
error(java.lang.Throwable t)
|
void |
run()
|
void |
shutdown()
Shutdown this server thread. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, 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 |
java.lang.String[] args
java.lang.String className
java.lang.Runnable runnable
Constructor Detail |
public CronThread(java.lang.ThreadGroup threadGroup, java.lang.String className, java.lang.String[] args)
threadGroup
- group that this thread will belong toclassName
- class to executeargs
- arguments to pass to the class.Method Detail |
public void shutdown()
Server
shutdown
in interface Server
public final void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void error(java.lang.Throwable t)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |