org.apache.avalon.excalibur.thread.impl
Class DefaultThreadPool
java.lang.Object
|
+--java.lang.ThreadGroup
|
+--org.apache.avalon.excalibur.thread.impl.DefaultThreadPool
- All Implemented Interfaces:
- org.apache.avalon.framework.component.Component, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.logger.Loggable, ObjectFactory, ThreadPool
- public class DefaultThreadPool
- extends java.lang.ThreadGroup
- implements ObjectFactory, org.apache.avalon.framework.logger.Loggable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.activity.Disposable, ThreadPool
This class is the public frontend for the thread pool code.
TODO: Should this be configured with min threads, max threads and min spare threads ?
- Author:
- Stefano Mazzocchi, Peter Donald
Methods inherited from class java.lang.ThreadGroup |
activeCount, activeGroupCount, allowThreadSuspension, checkAccess, destroy, enumerate, enumerate, enumerate, enumerate, getMaxPriority, getName, getParent, interrupt, isDaemon, isDestroyed, list, parentOf, resume, setDaemon, setMaxPriority, stop, suspend, toString, uncaughtException |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DefaultThreadPool
public DefaultThreadPool(int capacity)
throws java.lang.Exception
DefaultThreadPool
public DefaultThreadPool(java.lang.String name,
int capacity)
throws java.lang.Exception
DefaultThreadPool
public DefaultThreadPool(java.lang.String name,
int capacity,
ThreadContext context)
throws java.lang.Exception
setLogger
public void setLogger(org.apache.log.Logger logger)
- Specified by:
setLogger
in interface org.apache.avalon.framework.logger.Loggable
enableLogging
public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
- Specified by:
enableLogging
in interface org.apache.avalon.framework.logger.LogEnabled
dispose
public void dispose()
- Specified by:
dispose
in interface org.apache.avalon.framework.activity.Disposable
newInstance
public java.lang.Object newInstance()
- Specified by:
newInstance
in interface ObjectFactory
decommission
public void decommission(java.lang.Object object)
- Specified by:
decommission
in interface ObjectFactory
getCreatedClass
public java.lang.Class getCreatedClass()
- Specified by:
getCreatedClass
in interface ObjectFactory
execute
public ThreadControl execute(java.lang.Runnable work)
- Run work in separate thread.
Return a valid ThreadControl to control work thread.
- Specified by:
execute
in interface ThreadPool
- Parameters:
work
- the work to be executed.- Returns:
- the ThreadControl
execute
public ThreadControl execute(org.apache.avalon.framework.activity.Executable work)
- Run work in separate thread.
Return a valid ThreadControl to control work thread.
- Specified by:
execute
in interface ThreadPool
- Parameters:
work
- the work to be executed.- Returns:
- the ThreadControl
getWorker
protected org.apache.avalon.excalibur.thread.impl.WorkerThread getWorker()
- Retrieve a worker thread from pool.
- Returns:
- the worker thread retrieved from pool
- Throws:
java.lang.Exception
- if an error occurs
Copyright © 2001 Apache Jakarta Project. All Rights Reserved.