|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ThreadGroup
com.brackeen.javagamebook.util.ThreadPool
A thread pool is a group of a limited number of threads that are used to execute tasks.
Constructor Summary | |
ThreadPool(int numThreads)
Creates a new ThreadPool. |
Method Summary | |
void |
close()
Closes this ThreadPool and returns immediately. |
void |
join()
Closes this ThreadPool and waits for all running threads to finish. |
void |
runTask(java.lang.Runnable task)
Requests a new task to run. |
Methods inherited from class java.lang.ThreadGroup |
activeCount, activeGroupCount, allowThreadSuspension, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, parentOf, resume, setDaemon, setMaxPriority, stop, suspend, toString, uncaughtException |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ThreadPool(int numThreads)
numThreads
- The number of threads in the pool.Method Detail |
public void runTask(java.lang.Runnable task)
Tasks start execution in the order they are received.
task
- The task to run. If null, no action is taken.
java.lang.IllegalStateException
- if this ThreadPool is
already closed.public void close()
public void join()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |