groovyx.gpars.dataflow.operator.component
Class ProcessorPauseResume

java.lang.Object
  extended by groovyx.gpars.dataflow.operator.DataflowEventAdapter
      extended by groovyx.gpars.dataflow.operator.component.ProcessorPauseResume
All Implemented Interfaces:
DataflowEventListener

public final class ProcessorPauseResume
extends DataflowEventAdapter

A listener to dataflow operators and selectors allowing them to be paused and resumed.

Author:
Vaclav Pech

Field Summary
private  boolean paused
           
 
Constructor Summary
ProcessorPauseResume()
           
 
Method Summary
 java.util.List<java.lang.Object> beforeRun(DataflowProcessor processor, java.util.List<java.lang.Object> messages)
          Invoked when all messages required to trigger the operator become available in the input channels.
 void pause()
          Pauses the operator so that it blocks the next time it attempts to process a message.
 void resume()
          Resumes the operator so that it can start processing messages again.
 
Methods inherited from class groovyx.gpars.dataflow.operator.DataflowEventAdapter
afterRun, afterStart, afterStop, controlMessageArrived, customEvent, messageArrived, messageSentOut, onException, registered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

paused

private boolean paused
Constructor Detail

ProcessorPauseResume

public ProcessorPauseResume()
Method Detail

beforeRun

public java.util.List<java.lang.Object> beforeRun(DataflowProcessor processor,
                                                  java.util.List<java.lang.Object> messages)
Description copied from class: DataflowEventAdapter
Invoked when all messages required to trigger the operator become available in the input channels.

Specified by:
beforeRun in interface DataflowEventListener
Overrides:
beforeRun in class DataflowEventAdapter
Parameters:
processor - The reporting dataflow operator/selector
messages - The incoming messages
Returns:
The original list of messages or a modified/new list of messages that should be used instead

pause

public void pause()
Pauses the operator so that it blocks the next time it attempts to process a message. The operator's thread will be blocked, so care should be taken in order not to exhaust all available operator threads when pausing multiple operators.


resume

public void resume()
Resumes the operator so that it can start processing messages again.


Copyright © 2008–2012 Václav Pech. All Rights Reserved.