org.apache.avalon.excalibur.command
Class TPCThreadManager

java.lang.Object
  |
  +--org.apache.avalon.excalibur.command.TPCThreadManager
All Implemented Interfaces:
java.lang.Runnable, ThreadManager

public final class TPCThreadManager
extends java.lang.Object
implements java.lang.Runnable, ThreadManager

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.

Author:
Berin Loritsch

Inner Class Summary
static class TPCThreadManager.PipelineRunner
           
 
Constructor Summary
TPCThreadManager()
          The default constructor assumes there is a system property named "os.arch.cpus" that has a default for the number of CPUs on a system.
TPCThreadManager(int numProcessors)
          Constructor provides one thread per number of processors.
TPCThreadManager(int numProcessors, int threadsPerProcessor)
          Constructor provides a specified number of threads per processor.
TPCThreadManager(int numProcessors, int threadsPerProcessor, long sleepTime)
          Constructor provides a specified number of threads per processor.
TPCThreadManager(org.apache.avalon.framework.parameters.Parameters params)
          This constructor assumes there is a parameter named "os.arch.cpus" that has a default for the number of CPUs on a system.
 
Method Summary
 void deregister(EventPipeline pipeline)
          Deregister an EventPipeline with the ThreadManager
 void deregisterAll()
          Deregisters all EventPipelines from this ThreadManager
 void register(EventPipeline pipeline)
          Register an EventPipeline with the ThreadManager.
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TPCThreadManager

public TPCThreadManager()
The default constructor assumes there is a system property named "os.arch.cpus" that has a default for the number of CPUs on a system. Otherwise, the value is 1.

TPCThreadManager

public TPCThreadManager(org.apache.avalon.framework.parameters.Parameters params)
This constructor assumes there is a parameter named "os.arch.cpus" that has a default for the number of CPUs on a system. Otherwise, the value is 1.

TPCThreadManager

public TPCThreadManager(int numProcessors)
Constructor provides one thread per number of processors.

TPCThreadManager

public TPCThreadManager(int numProcessors,
                        int threadsPerProcessor)
Constructor provides a specified number of threads per processor. If either value is less then one, then the value is rewritten as one.

TPCThreadManager

public TPCThreadManager(int numProcessors,
                        int threadsPerProcessor,
                        long sleepTime)
Constructor provides a specified number of threads per processor. If either value is less then one, then the value is rewritten as one.
Method Detail

register

public void register(EventPipeline pipeline)
Register an EventPipeline with the ThreadManager.
Specified by:
register in interface ThreadManager

deregister

public void deregister(EventPipeline pipeline)
Deregister an EventPipeline with the ThreadManager
Specified by:
deregister in interface ThreadManager

deregisterAll

public void deregisterAll()
Deregisters all EventPipelines from this ThreadManager
Specified by:
deregisterAll in interface ThreadManager

run

public void run()
Specified by:
run in interface java.lang.Runnable


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.