org.d_haven.event.command
Interface ThreadPolicy

All Known Implementing Classes:
AbstractThreadPolicy, OneThreadPolicy, ProcessorBoundThreadPolicy

public interface ThreadPolicy

The ThreadPolicy is used to control how the EventPipelineRunner is set up, and how new threads are created and destroyed over the life of the system.


Method Summary
 EventPipelineRunner createRunner(EventPipeline pipeline)
          Create the EventPipelineRunner that will be used to get events from the Sources to the EventHandler.
 void executeLoop(ThreadManager manager)
          Execute the management loop.
 boolean isRunning()
          Provides a way to tell if the management loop is currently running or not.
 void setThreadFactory(EDU.oswego.cs.dl.util.concurrent.ThreadFactory factory)
          Set the ThreadFactory for the policy to use.
 void terminateLoop()
          Stops the management loop.
 

Method Detail

setThreadFactory

void setThreadFactory(EDU.oswego.cs.dl.util.concurrent.ThreadFactory factory)
Set the ThreadFactory for the policy to use. All new threads created after this is set will use the supplied factory.

Parameters:
factory - the factory to use

createRunner

EventPipelineRunner createRunner(EventPipeline pipeline)
Create the EventPipelineRunner that will be used to get events from the Sources to the EventHandler.

Parameters:
pipeline - the pipeline to run
Returns:
the EventPipelineRunner

executeLoop

void executeLoop(ThreadManager manager)
                 throws java.lang.InterruptedException
Execute the management loop. The ThreadManager will call this at the appropriate times. This is a signal to start moving the events through the system.

Parameters:
manager - the ThreadManager calling
Throws:
java.lang.InterruptedException - if the current thread is interrupted

terminateLoop

void terminateLoop()
                   throws java.lang.InterruptedException
Stops the management loop. The ThreadManager will call this at the appropriate times. This is a signal to stop moving the events through the system.

Throws:
java.lang.InterruptedException - if the current thread is interrupted

isRunning

boolean isRunning()
Provides a way to tell if the management loop is currently running or not.

Returns:
true if the management loop is running