|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.excalibur.thread.impl.AbstractThreadPool
This is the base class of all ThreadPools. Sub-classes should implement the abstract methods to retrieve and return Threads to the pool.
| Field Summary | |
private int |
m_levelA Running number that indicates the number of threads created by pool. |
private java.lang.String |
m_nameThe name of the thread pool. |
private java.lang.ThreadGroup |
m_threadGroupThe thread group associated with pool. |
| Constructor Summary | |
AbstractThreadPool(java.lang.String name, java.lang.ThreadGroup threadGroup)Create a ThreadPool with the specified name. |
|
| Method Summary | |
protected WorkerThread |
createWorker()Create a WorkerThread and start it up. |
protected void |
destroyWorker(WorkerThread thread)Destroy a worker thread by scheduling it for shutdown. |
ThreadControl |
execute(Executable work)Execute some executable work in a thread. |
ThreadControl |
execute(java.lang.Runnable work)Run work in separate thread. |
protected java.lang.String |
getName()Get the name used for thread pool. |
protected java.lang.ThreadGroup |
getThreadGroup()Return the thread group that thread pool is associated with. |
protected abstract WorkerThread |
getWorker()Retrieve a worker thread from pool. |
protected WorkerThread |
newWorkerThread(java.lang.String name)Create a new worker for pool. |
protected abstract void |
releaseWorker(WorkerThread worker)Return the WorkerThread to the pool. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private final java.lang.ThreadGroup m_threadGroup
private final java.lang.String m_name
private int m_level
| Constructor Detail |
public AbstractThreadPool(java.lang.String name,
java.lang.ThreadGroup threadGroup)
throws java.lang.Exception
name - the name of thread pool (appears in thread group and thread names)java.lang.Exception - if unable to create pool| Method Detail |
protected void destroyWorker(WorkerThread thread)
thread - the worker threadprotected WorkerThread createWorker()
protected WorkerThread newWorkerThread(java.lang.String name)
name - the name of workerpublic ThreadControl execute(java.lang.Runnable work)
execute in interface ThreadPoolwork - the work to be executed.public ThreadControl execute(Executable work)
execute in interface ThreadPoolwork - the workprotected java.lang.String getName()
protected java.lang.ThreadGroup getThreadGroup()
protected abstract WorkerThread getWorker()
protected abstract void releaseWorker(WorkerThread worker)
worker - the worker thread to put back in pool
|
Keel 2.1RC2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||