|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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.
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 |
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 poolMethod Detail |
protected void destroyWorker(WorkerThread thread)
thread
- the worker threadprotected WorkerThread createWorker()
protected WorkerThread newWorkerThread(java.lang.String name)
name
- the name of worker
public ThreadControl execute(java.lang.Runnable work)
execute
in interface ThreadPool
work
- the work to be executed.
public ThreadControl execute(Executable work)
execute
in interface ThreadPool
work
- the work
protected 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
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |