public abstract class AbstractThreadPool
extends java.lang.Object
implements org.apache.excalibur.thread.ThreadPool
| Modifier and Type | Field and Description |
|---|---|
private int |
m_level
A Running number that indicates the number
of threads created by pool.
|
private java.lang.String |
m_name
The name of the thread pool.
|
private java.lang.ThreadGroup |
m_threadGroup
The thread group associated with pool.
|
| Constructor and Description |
|---|
AbstractThreadPool(java.lang.String name,
java.lang.ThreadGroup threadGroup)
Create a ThreadPool with the specified name.
|
| Modifier and Type | Method and Description |
|---|---|
protected WorkerThread |
createWorker()
Create a WorkerThread and start it up.
|
protected void |
destroyWorker(WorkerThread thread)
Destroy a worker thread by scheduling it for shutdown.
|
org.apache.excalibur.thread.ThreadControl |
execute(org.apache.excalibur.thread.Executable work)
Execute some executable work in a thread.
|
org.apache.excalibur.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.
|
private final java.lang.ThreadGroup m_threadGroup
private final java.lang.String m_name
private int m_level
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 poolprotected void destroyWorker(WorkerThread thread)
thread - the worker threadprotected WorkerThread createWorker()
protected WorkerThread newWorkerThread(java.lang.String name)
name - the name of workerpublic org.apache.excalibur.thread.ThreadControl execute(java.lang.Runnable work)
execute in interface org.apache.excalibur.thread.ThreadPoolwork - the work to be executed.public org.apache.excalibur.thread.ThreadControl execute(org.apache.excalibur.thread.Executable work)
execute in interface org.apache.excalibur.thread.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