|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjava.lang.Thread
org.sadun.util.tp.ThreadPoolThread
A thread which acts as a pool for other threads. Its run methods simply waits if there aren't runnable start requests.
Albeit it is not type-compatible with ThreadPool (since
it extends Thread) this class exposes the same methods.
| Field Summary |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
ThreadPoolThread(int size)
Create a pool of daemon threads with the given size and a FIFO waiting queue |
|
ThreadPoolThread(int size,
boolean daemon)
Create a pool with the given size with a FIFO queue |
|
ThreadPoolThread(int size,
boolean daemon,
Queue queue)
Create a pool with the given size using the given queue object. |
|
| Method Summary | |
int |
getQueueSize()
Return the number of thread currently queued |
boolean |
isShuttingDown()
Return true if a shutdown has been requested. |
void |
run()
|
void |
shutdown()
Unconditionally requests a shutdown. |
int |
size()
Return the size of the pool |
boolean |
start(java.lang.Runnable runnable)
Adds a runnable object to the pool. |
| 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 ThreadPoolThread(int size,
boolean daemon,
Queue queue)
size - the size of the pooldaemon - if true the pools will be daemonqueue - the queue to use for determining the next thread to
instantiate when there are pending start requests.
public ThreadPoolThread(int size,
boolean daemon)
size - the size of the pooldaemon - if true the pools will be daemonpublic ThreadPoolThread(int size)
size - the size of the pool| Method Detail |
public int size()
public int getQueueSize()
public boolean start(java.lang.Runnable runnable)
runnable - the Runnable object to execute
public void shutdown()
Terminable
shutdown in interface Terminablepublic boolean isShuttingDown()
Terminable
isShuttingDown in interface Terminablepublic void run()
run in interface java.lang.Runnable
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||