class BasicThreadPool extends AbstractThreadPool implements org.apache.avalon.excalibur.pool.ObjectFactory, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.activity.Disposable, org.apache.excalibur.thread.ThreadPool
| Modifier and Type | Field and Description |
|---|---|
private org.apache.avalon.framework.logger.Logger |
m_logger
The logger to use for debugging purposes.
|
private org.apache.avalon.excalibur.pool.Pool |
m_pool
The underlying pool.
|
| Constructor and Description |
|---|
BasicThreadPool(java.lang.ThreadGroup threadGroup,
java.lang.String name,
org.apache.avalon.excalibur.pool.Pool pool)
Create a new ThreadPool with specified capacity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
decommission(java.lang.Object object) |
void |
dispose()
Dispose of underlying pool and cleanup resources.
|
void |
enableLogging(org.apache.avalon.framework.logger.Logger logger)
Setup Logging.
|
org.apache.excalibur.thread.ThreadControl |
execute(org.apache.avalon.framework.activity.Executable work)
Run work in separate thread.
|
java.lang.Class |
getCreatedClass()
Return the class of poolable instance.
|
protected WorkerThread |
getWorker()
Retrieve a worker thread from pool.
|
java.lang.Object |
newInstance()
Create new Poolable instance.
|
protected WorkerThread |
newWorkerThread(java.lang.String name)
Overide newWorkerThread to provide a WorkerThread
that is Poolable and LogEnabled.
|
protected void |
releaseWorker(WorkerThread worker)
Release worker back into pool.
|
createWorker, destroyWorker, execute, execute, getName, getThreadGroupprivate org.apache.avalon.excalibur.pool.Pool m_pool
private org.apache.avalon.framework.logger.Logger m_logger
public BasicThreadPool(java.lang.ThreadGroup threadGroup,
java.lang.String name,
org.apache.avalon.excalibur.pool.Pool pool)
throws java.lang.Exception
threadGroup - the thread group used in poolname - the name of pool (used in naming threads)pool - the underling pooljava.lang.Exception - if unable to create poolpublic void enableLogging(org.apache.avalon.framework.logger.Logger logger)
enableLogging in interface org.apache.avalon.framework.logger.LogEnabledlogger - the loggerpublic void dispose()
dispose in interface org.apache.avalon.framework.activity.Disposablepublic java.lang.Object newInstance()
newInstance in interface org.apache.avalon.excalibur.pool.ObjectFactoryprotected WorkerThread newWorkerThread(java.lang.String name)
newWorkerThread in class AbstractThreadPoolname - the name of WorkerThreadpublic void decommission(java.lang.Object object)
decommission in interface org.apache.avalon.excalibur.pool.ObjectFactorypublic java.lang.Class getCreatedClass()
getCreatedClass in interface org.apache.avalon.excalibur.pool.ObjectFactorypublic org.apache.excalibur.thread.ThreadControl execute(org.apache.avalon.framework.activity.Executable work)
work - the work to be executed.protected WorkerThread getWorker()
getWorker in class AbstractThreadPoolprotected void releaseWorker(WorkerThread worker)
releaseWorker in class AbstractThreadPoolworker - the worker (Should be a SimpleWorkerThread).