org.apache.excalibur.event.command
Class AbstractThreadManager

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

public abstract class AbstractThreadManager
extends AbstractLogEnabled
implements java.lang.Runnable, ThreadManager, Initializable, Disposable

Abstract base class for a ThreadManager that has a single ThreadPool for all pipelines

Author:
Avalon Development Team

Nested Class Summary
static class AbstractThreadManager.PipelineRunner
          The PipelineRunner class pulls all the events from the Source, and puts them in the EventHandler.
 
Field Summary
 
Fields inherited from interface org.apache.excalibur.event.command.ThreadManager
ROLE
 
Constructor Summary
AbstractThreadManager()
           
 
Method Summary
 void deregister(EventPipeline pipeline)
          Deregister an EventPipeline with the ThreadManager
 void deregisterAll()
          Deregisters all EventPipelines from this ThreadManager
 void dispose()
          Get rid of the ThreadManager.
protected  void doDispose()
           
protected  long getSleepTime()
          Get the current amount of sleep time.
 void initialize()
          Set up the ThreadManager.
protected  boolean isInitialized()
          Return whether the thread manager has been initialized or not
 void register(EventPipeline pipeline)
          Register an EventPipeline with the ThreadManager.
 void run()
          The code that is run in the background to manage the ThreadPool and the EventPipelines
protected  void setExecutor(EDU.oswego.cs.dl.util.concurrent.Executor executor)
          Set the executor we are using
protected  void setSleepTime(long sleepTime)
          Set the amount of time to sleep between checks on the queue
 
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
 

Constructor Detail

AbstractThreadManager

public AbstractThreadManager()
Method Detail

isInitialized

protected boolean isInitialized()
Return whether the thread manager has been initialized or not


setSleepTime

protected void setSleepTime(long sleepTime)
Set the amount of time to sleep between checks on the queue

Parameters:
sleepTime - Number of milliseconds

getSleepTime

protected long getSleepTime()
Get the current amount of sleep time.


setExecutor

protected void setExecutor(EDU.oswego.cs.dl.util.concurrent.Executor executor)
Set the executor we are using

Parameters:
executor - to use

initialize

public void initialize()
                throws java.lang.Exception
Set up the ThreadManager. All required parameters must have already been set.

Specified by:
initialize in interface Initializable
Throws:
java.lang.Exception - if there is any problem setting up the ThreadManager

register

public void register(EventPipeline pipeline)
Register an EventPipeline with the ThreadManager.

Specified by:
register in interface ThreadManager
Parameters:
pipeline - The pipeline we are registering

deregister

public void deregister(EventPipeline pipeline)
Deregister an EventPipeline with the ThreadManager

Specified by:
deregister in interface ThreadManager
Parameters:
pipeline - The pipeline we are de-registering

deregisterAll

public void deregisterAll()
Deregisters all EventPipelines from this ThreadManager

Specified by:
deregisterAll in interface ThreadManager

dispose

public void dispose()
Get rid of the ThreadManager.

Specified by:
dispose in interface Disposable

doDispose

protected void doDispose()

run

public void run()
The code that is run in the background to manage the ThreadPool and the EventPipelines

Specified by:
run in interface java.lang.Runnable


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.