Keel 2.1RC2

org.apache.excalibur.event.command
Class TPCThreadManager

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

public final class TPCThreadManager
extends AbstractThreadManager
implements 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:

Nested Class Summary
 
Nested classes 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  PooledExecutor m_threadPool
           
private  int m_threadsPerProcessor
           
 
Fields inherited from class org.apache.excalibur.event.command.AbstractThreadManager
 
Fields inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
 
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(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
 

Field Detail

m_threadPool

private 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(Parameters parameters)
                  throws 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 Parameterizable
Parameters:
parameters - The Parameters object
Throws:
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 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

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.