|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
com.rhi.architecture.threads.WorkerThread
Worker Threads performs a given work and sleeps after the work is finished. The thread is managed by a ThreadPool and is used in conjuction with a ThreadPool. The threads sleeps as long as there is no work to be performed. ThreadPool assigns work to the thread and wakes up the WorkerThread to perform the given work. Once the thread finishes the work it sets itself to as having no work.
Field Summary |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
WorkerThread(ThreadPool pool)
Constructor - constructs a WorkerThread |
Method Summary | |
void |
markForShutDown()
mark the thread to be shutdown. |
boolean |
noWork()
return true is there is no work to be performed. |
void |
run()
Perform the following steps, in a loop, until asked to shutdown: 1. |
void |
setNoWork()
assign no work to the worked thread. |
void |
setWork(java.lang.Runnable action)
Sets the work to be performed by the 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 |
Constructor Detail |
public WorkerThread(ThreadPool pool)
pool
- - reference to the managing ThreadPoolMethod Detail |
public void run()
public boolean noWork()
public void setNoWork()
public void markForShutDown()
public void setWork(java.lang.Runnable action)
action
- - action to be performed by the thread
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |