public abstract class AbstractThreadManager
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements java.lang.Runnable, org.apache.excalibur.event.command.ThreadManager, org.apache.avalon.framework.activity.Initializable, org.apache.avalon.framework.activity.Disposable
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractThreadManager.PipelineRunner
The PipelineRunner class pulls all the events from the Source, and puts them in the EventHandler.
|
| Modifier and Type | Field and Description |
|---|---|
private boolean |
m_done
Whether we are done or not
|
private EDU.oswego.cs.dl.util.concurrent.Executor |
m_executor
The ThreadPool we are using
|
private boolean |
m_initialized
Whether this class has been initialized or not
|
private org.apache.commons.collections.StaticBucketMap |
m_pipelines
The pipelines we are managing
|
private long |
m_sleepTime
The number of milliseconds to sleep before runngin again: 1000 (1 sec.)
|
| Constructor and Description |
|---|
AbstractThreadManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
deregister(org.apache.excalibur.event.command.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(org.apache.excalibur.event.command.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
|
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerprivate final org.apache.commons.collections.StaticBucketMap m_pipelines
private EDU.oswego.cs.dl.util.concurrent.Executor m_executor
private volatile boolean m_done
private long m_sleepTime
private volatile boolean m_initialized
protected boolean isInitialized()
protected void setSleepTime(long sleepTime)
sleepTime - Number of millisecondsprotected long getSleepTime()
protected void setExecutor(EDU.oswego.cs.dl.util.concurrent.Executor executor)
executor - to usepublic void initialize()
throws java.lang.Exception
initialize in interface org.apache.avalon.framework.activity.Initializablejava.lang.Exception - if there is any problem setting up the ThreadManagerpublic void register(org.apache.excalibur.event.command.EventPipeline pipeline)
register in interface org.apache.excalibur.event.command.ThreadManagerpipeline - The pipeline we are registeringpublic void deregister(org.apache.excalibur.event.command.EventPipeline pipeline)
deregister in interface org.apache.excalibur.event.command.ThreadManagerpipeline - The pipeline we are de-registeringpublic void deregisterAll()
deregisterAll in interface org.apache.excalibur.event.command.ThreadManagerpublic void dispose()
dispose in interface org.apache.avalon.framework.activity.Disposableprotected void doDispose()
public void run()
run in interface java.lang.Runnable