public class ResourceLimitingThreadPool
extends java.lang.ThreadGroup
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 BasicThreadPool |
m_pool
The associated thread pool.
|
private org.apache.avalon.excalibur.pool.ResourceLimitingPool |
m_underlyingPool |
| Constructor and Description |
|---|
ResourceLimitingThreadPool(int max)
Creates a new
ResourceLimitingThreadPool. |
ResourceLimitingThreadPool(java.lang.String name,
int max)
Creates a new
ResourceLimitingThreadPool with maxStrict enabled,
blocking enabled, no block timeout and a trim interval of 10 seconds. |
ResourceLimitingThreadPool(java.lang.String name,
int max,
boolean maxStrict,
boolean blocking,
long blockTimeout,
long trimInterval)
Creates a new
ResourceLimitingThreadPool. |
| Modifier and Type | Method and Description |
|---|---|
void |
decommission(java.lang.Object object) |
void |
dispose() |
void |
enableLogging(org.apache.avalon.framework.logger.Logger logger) |
org.apache.excalibur.thread.ThreadControl |
execute(org.apache.avalon.framework.activity.Executable work)
Run work in separate thread.
|
org.apache.excalibur.thread.ThreadControl |
execute(org.apache.excalibur.thread.Executable work)
Run work in separate thread.
|
org.apache.excalibur.thread.ThreadControl |
execute(java.lang.Runnable work)
Run work in separate thread.
|
java.lang.Class |
getCreatedClass() |
int |
getSize()
Return the number of worker threads in the pool.
|
java.lang.Object |
newInstance() |
activeCount, activeGroupCount, allowThreadSuspension, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, parentOf, resume, setDaemon, setMaxPriority, stop, suspend, toString, uncaughtExceptionprivate org.apache.avalon.excalibur.pool.ResourceLimitingPool m_underlyingPool
private BasicThreadPool m_pool
public ResourceLimitingThreadPool(int max)
ResourceLimitingThreadPool.max - Maximum number of Poolables which can be stored in the pool, 0 implies no limit.public ResourceLimitingThreadPool(java.lang.String name,
int max)
ResourceLimitingThreadPool with maxStrict enabled,
blocking enabled, no block timeout and a trim interval of 10 seconds.name - Name which will used as the thread group name as well as the prefix of the
names of all threads created by the pool.max - Maximum number of WorkerThreads which can be stored in the pool,
0 implies no limit.public ResourceLimitingThreadPool(java.lang.String name,
int max,
boolean maxStrict,
boolean blocking,
long blockTimeout,
long trimInterval)
ResourceLimitingThreadPool.name - Name which will used as the thread group name as well as the prefix of the
names of all threads created by the pool.max - Maximum number of WorkerThreads which can be stored in the pool,
0 implies no limit.maxStrict - true if the pool should never allow more than max WorkerThreads to
be created. Will cause an exception to be thrown if more than max WorkerThreads are
requested and blocking is false.blocking - true if the pool should cause a thread calling get() to block when
WorkerThreads are not currently available on the pool.blockTimeout - The maximum amount of time, in milliseconds, that a call to get() will
block before an exception is thrown. A value of 0 implies an indefinate wait.trimInterval - The minimum interval with which old unused WorkerThreads will be
removed from the pool. A value of 0 will cause the pool to never trim WorkerThreads.public int getSize()
public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
enableLogging in interface org.apache.avalon.framework.logger.LogEnabledpublic void dispose()
dispose in interface org.apache.avalon.framework.activity.Disposablepublic java.lang.Object newInstance()
newInstance in interface org.apache.avalon.excalibur.pool.ObjectFactorypublic 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.public 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 work to be executed.