|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
com.cometway.util.PooledThread
public class PooledThread
This is a Thread used by the ThreadPool class. This thread does not stop until it is no longer needed and is dispoed of. After this thread executes a KMethod (which can wrap a Runnable), Object.wait() is called. The PooledThread will wait until it is notified by Object.notify(), in which case it checks its method field for a KMethod to execute. If an object was passed in through setMethod(), then that object is notified when the execution is complete.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
int |
id
|
boolean |
stopRunning
|
int |
threadTimeOut
|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
PooledThread(ThreadPool pool)
Creates a new PooledThread. |
|
| Method Summary | |
|---|---|
void |
run()
Executes the KMethod.execute(), notifies any object which was waiting, resets state and waits. |
void |
setMethod(KMethod method)
This sets the KMethod field of this PooledThread. |
void |
setMethod(KMethod method,
java.lang.Object obj)
This sets the KMethod and Object fields of this PooledThread. |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, 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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public boolean stopRunning
public int threadTimeOut
public int id
| Constructor Detail |
|---|
public PooledThread(ThreadPool pool)
| Method Detail |
|---|
public void setMethod(KMethod method,
java.lang.Object obj)
public void setMethod(KMethod method)
public void run()
run in interface java.lang.Runnablerun in class java.lang.Thread
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||