|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.dmonix.thread.ThreadPool
This class implements a thread pool.
Copyright: Copyright (c) 2003
Company: dmonix.org
| Constructor Summary | |
ThreadPool()
Creates an empty pool. |
|
ThreadPool(int initialThreadCount)
Creates a pool with an initial amount of PooledThreads. |
|
| Method Summary | |
void |
addThread(java.lang.Runnable runnable)
Adds a new thread to the pool. |
int |
getCurrentThreadCount()
Get the current size of the pool. |
int |
getInitialThreadCount()
Get the initial size of the pool. |
int |
getRunningThreadCount()
Get the amount of running/busy threads. |
PooledThread |
getThread()
Get a thread from the pool. |
long |
getThreadRequests()
Get the number of times a thread has been requested from the pool. |
void |
resetThreadRequests()
Reset the counter for the number of times a thread has been requested from the pool. |
void |
returnThread(PooledThread t)
Return a thread to the pool. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ThreadPool()
addThread
addThread(Runnable)public ThreadPool(int initialThreadCount)
initialThreadCount - The inital number of threads| Method Detail |
public void addThread(java.lang.Runnable runnable)
PooledThread object.
runnable - The runnable to use in the PooledThreadorg.dmonix.thread.PooledThread.runpublic int getInitialThreadCount()
public int getCurrentThreadCount()
public int getRunningThreadCount()
public long getThreadRequests()
public void resetThreadRequests()
public PooledThread getThread()
wait()
public void returnThread(PooledThread t)
notify()
in order to release any thread waiting in the method getThread()
t - The thread to return
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||