org.apache.excalibur.event.command
Class TPSPThreadManager.SourceDequeueInterceptor

java.lang.Object
  extended by org.apache.excalibur.event.command.TPSPThreadManager.SourceDequeueInterceptor
All Implemented Interfaces:
org.apache.excalibur.event.DequeueInterceptor
Enclosing class:
TPSPThreadManager

protected static final class TPSPThreadManager.SourceDequeueInterceptor
extends java.lang.Object
implements org.apache.excalibur.event.DequeueInterceptor

This is used to plug into Queues so that we can intercept calls to the dequeue operation.


Field Summary
private  org.apache.excalibur.event.EventHandler m_handler
           
private  TPSPThreadManager.SourceRunner m_initRunner
           
private  int m_margin
           
private  org.apache.excalibur.event.DequeueInterceptor m_parent
           
private  java.util.LinkedList m_runners
           
private  org.apache.excalibur.event.Source m_source
           
private  EDU.oswego.cs.dl.util.concurrent.PooledExecutor m_threadPool
           
private  int m_threshold
           
 
Constructor Summary
TPSPThreadManager.SourceDequeueInterceptor(TPSPThreadManager.SourceRunner runner, org.apache.excalibur.event.EventHandler handler, EDU.oswego.cs.dl.util.concurrent.PooledExecutor threadPool, int threshold, int margin)
          Create a new SourceDequeueInterceptor.
 
Method Summary
 void after(org.apache.excalibur.event.Source context)
          An operation executed after dequeing events from the queue.
 void before(org.apache.excalibur.event.Source context)
          An operation executed before dequeing events from the queue.
 void stop()
          Ensure all event runners are stopped for this partial pipeline.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_source

private final org.apache.excalibur.event.Source m_source

m_threadPool

private final EDU.oswego.cs.dl.util.concurrent.PooledExecutor m_threadPool

m_threshold

private final int m_threshold

m_parent

private final org.apache.excalibur.event.DequeueInterceptor m_parent

m_margin

private final int m_margin

m_runners

private final java.util.LinkedList m_runners

m_handler

private final org.apache.excalibur.event.EventHandler m_handler

m_initRunner

private final TPSPThreadManager.SourceRunner m_initRunner
Constructor Detail

TPSPThreadManager.SourceDequeueInterceptor

public TPSPThreadManager.SourceDequeueInterceptor(TPSPThreadManager.SourceRunner runner,
                                                  org.apache.excalibur.event.EventHandler handler,
                                                  EDU.oswego.cs.dl.util.concurrent.PooledExecutor threadPool,
                                                  int threshold,
                                                  int margin)
Create a new SourceDequeueInterceptor. The parameters are used to ensure a working environment.

Parameters:
runner - The initial SourceRunner.
handler - The EventHandler to send events to.
threadPool - The PooledExecutor for the set of threads.
threshold - The threshold of events before a new thread is executed.
margin - The margin of error allowed for the events.
Method Detail

before

public void before(org.apache.excalibur.event.Source context)
An operation executed before dequeing events from the queue. The Source is passed in so the implementation can determine to execute based on the queue properties.

This method is called once at the beginning of any dequeue method regardless of how many queue elements are dequeued.

Specified by:
before in interface org.apache.excalibur.event.DequeueInterceptor
Parameters:
context - The source from which the dequeue is performed.
Since:
Feb 10, 2003

after

public void after(org.apache.excalibur.event.Source context)
An operation executed after dequeing events from the queue. The Source is passed in so the implementation can determine to execute based on the queue properties.

This method is called once at the end of any dequeue method regardless of how many queue elements are dequeued.

Specified by:
after in interface org.apache.excalibur.event.DequeueInterceptor
Parameters:
context - The source from which the dequeue is performed.
Since:
Feb 10, 2003

stop

public void stop()
Ensure all event runners are stopped for this partial pipeline.