org.knopflerfish.util.workerthread
public class WorkerThread extends java.lang.Thread
Constructor and Description |
---|
WorkerThread()
Creates a Workerthread.
|
WorkerThread(java.lang.String name)
Creates a named Workerthread.
|
WorkerThread(java.lang.ThreadGroup group,
java.lang.String name)
Creates a named Workerthread belonging toi the specified ThreadGroup.
|
Modifier and Type | Method and Description |
---|---|
void |
addJob(Job job)
Adds a job to be processed last in the job queue.
|
void |
addJob(Job job,
long delayMillis)
Adds a job to be processed after given delay.
|
boolean |
isRunning()
Returns true if this Workerthread is running.
|
protected void |
postMainLoopHook()
Override this method in subclasses.
|
protected void |
preMainLoopHook()
Override this method in subclasses.
|
void |
removeJob(Job job)
Removes a job from the job queue (linear-time operation).
|
void |
run() |
void |
shutdown()
Call this method to stop job processing and cause this Workerthread to
exit its run() method.
|
protected void |
status(java.lang.String msg,
Job job,
java.lang.Exception e) |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public WorkerThread()
public WorkerThread(java.lang.String name)
public WorkerThread(java.lang.ThreadGroup group, java.lang.String name)
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected void preMainLoopHook()
protected void postMainLoopHook()
public void shutdown()
public boolean isRunning()
public void addJob(Job job)
public void addJob(Job job, long delayMillis)
delayMillis
milliseconds has passed, the job will be
placed last in the job queue.public void removeJob(Job job)
protected void status(java.lang.String msg, Job job, java.lang.Exception e)