org.apache.excalibur.event.command
Class TPCThreadManager

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.excalibur.event.command.AbstractThreadManager
          extended by org.apache.excalibur.event.command.TPCThreadManager
All Implemented Interfaces:
java.lang.Runnable, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.parameters.Parameterizable, org.apache.excalibur.event.command.ThreadManager

public final class TPCThreadManager
extends AbstractThreadManager
implements org.apache.avalon.framework.parameters.Parameterizable

This is a ThreadManager that uses a certain number of threads per processor. The number of threads in the pool is a direct proportion to the number of processors. The size of the thread pool is (processors threads-per-processor) + 1

Author:
Avalon Development Team

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.excalibur.event.command.AbstractThreadManager
AbstractThreadManager.PipelineRunner
 
Field Summary
private  boolean m_hardShutdown
           
private  int m_keepAliveTime
           
private  int m_processors
           
private  EDU.oswego.cs.dl.util.concurrent.PooledExecutor m_threadPool
           
private  int m_threadsPerProcessor
           
 
Fields inherited from interface org.apache.excalibur.event.command.ThreadManager
ROLE
 
Constructor Summary
TPCThreadManager()
           
 
Method Summary
protected  void doDispose()
           
 void initialize()
          Set up the ThreadManager.
 void parameterize(org.apache.avalon.framework.parameters.Parameters parameters)
          The following parameters can be set for this class: Name Description Default Value processors Number of processors (autodetected if less than one) Results from SystemUtil.numProcessors() threads-per-processor Threads per processor to use (Rewritten to 1 if less than one) 1 sleep-time Time (in milliseconds) to wait between queue pipeline processing runs 1000 keep-alive-time Time (in milliseconds) that idle threads should remain in the threadpool 300000 force-shutdown At shutdown time, allow currently queued tasks to finish, or immediately quit false
 
Methods inherited from class org.apache.excalibur.event.command.AbstractThreadManager
deregister, deregisterAll, dispose, getSleepTime, isInitialized, register, run, setExecutor, setSleepTime
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.excalibur.event.command.ThreadManager
 

Field Detail

m_threadPool

private EDU.oswego.cs.dl.util.concurrent.PooledExecutor m_threadPool

m_processors

private int m_processors

m_threadsPerProcessor

private int m_threadsPerProcessor

m_keepAliveTime

private int m_keepAliveTime

m_hardShutdown

private boolean m_hardShutdown
Constructor Detail

TPCThreadManager

public TPCThreadManager()
Method Detail

parameterize

public void parameterize(org.apache.avalon.framework.parameters.Parameters parameters)
                  throws org.apache.avalon.framework.parameters.ParameterException
The following parameters can be set for this class:
Name Description Default Value
processors Number of processors (autodetected if less than one) Results from SystemUtil.numProcessors()
threads-per-processor Threads per processor to use (Rewritten to 1 if less than one) 1
sleep-time Time (in milliseconds) to wait between queue pipeline processing runs 1000
keep-alive-time Time (in milliseconds) that idle threads should remain in the threadpool 300000
force-shutdown At shutdown time, allow currently queued tasks to finish, or immediately quit false

Specified by:
parameterize in interface org.apache.avalon.framework.parameters.Parameterizable
Parameters:
parameters - The Parameters object
Throws:
org.apache.avalon.framework.parameters.ParameterException - if there is a problem with the parameters.

initialize

public void initialize()
                throws java.lang.Exception
Description copied from class: AbstractThreadManager
Set up the ThreadManager. All required parameters must have already been set.

Specified by:
initialize in interface org.apache.avalon.framework.activity.Initializable
Overrides:
initialize in class AbstractThreadManager
Throws:
java.lang.Exception - if there is any problem setting up the ThreadManager

doDispose

protected final void doDispose()
Overrides:
doDispose in class AbstractThreadManager