org.d_haven.event.command
Class OneThreadPolicy

java.lang.Object
  extended by org.d_haven.event.command.AbstractThreadPolicy
      extended by org.d_haven.event.command.OneThreadPolicy
All Implemented Interfaces:
java.lang.Runnable, ThreadPolicy

public class OneThreadPolicy
extends AbstractThreadPolicy

Created by IntelliJ IDEA. User: bloritsch Date: Jun 14, 2004 Time: 2:27:44 PM To change this template use File | Settings | File Templates.


Field Summary
private  EDU.oswego.cs.dl.util.concurrent.ThreadFactory m_factory
           
private  java.lang.Thread m_runner
           
 
Constructor Summary
OneThreadPolicy()
           
 
Method Summary
 EventPipelineRunner createRunner(EventPipeline pipeline)
          Create the EventPipelineRunner that will be used to get events from the Sources to the EventHandler.
protected  void process(java.util.Collection pipelines)
          Do the actual management logic that needs to be done in each time through the main loop.
 void setThreadFactory(EDU.oswego.cs.dl.util.concurrent.ThreadFactory factory)
          Set the ThreadFactory for the policy to use.
protected  void startLoop()
          Provide a hook to do further initialization when we start the management loop.
 java.lang.String toString()
           
 
Methods inherited from class org.d_haven.event.command.AbstractThreadPolicy
endLoop, executeLoop, isRunning, run, terminateLoop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_factory

private EDU.oswego.cs.dl.util.concurrent.ThreadFactory m_factory

m_runner

private java.lang.Thread m_runner
Constructor Detail

OneThreadPolicy

public OneThreadPolicy()
Method Detail

setThreadFactory

public void setThreadFactory(EDU.oswego.cs.dl.util.concurrent.ThreadFactory factory)
Description copied from interface: ThreadPolicy
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

public EventPipelineRunner createRunner(EventPipeline pipeline)
Description copied from interface: ThreadPolicy
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

startLoop

protected void startLoop()
                  throws java.lang.InterruptedException
Description copied from class: AbstractThreadPolicy
Provide a hook to do further initialization when we start the management loop. It is very important to remember to actually start the AbstractThreadPolicy.run() method. This object is Runnable so you can pass it in to a new thread.

Specified by:
startLoop in class AbstractThreadPolicy
Throws:
java.lang.InterruptedException - if the calling thread is interrupted

process

protected void process(java.util.Collection pipelines)
                throws java.lang.Exception
Description copied from class: AbstractThreadPolicy
Do the actual management logic that needs to be done in each time through the main loop.

Specified by:
process in class AbstractThreadPolicy
Parameters:
pipelines - The pipelines to manage
Throws:
java.lang.Exception - if there is a problem or the thread is interrupted

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object