|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgroovyx.gpars.dataflow.operator.DataflowEventAdapter
groovyx.gpars.dataflow.operator.component.GracefulShutdownListener
public class GracefulShutdownListener
Listens to an operator/selector and reports its state and activity to a GracefulShutdownMonitor, shared with other listeners.
| Field Summary | |
|---|---|
private java.util.concurrent.atomic.AtomicInteger |
activeForks
|
private boolean |
collectingMessages
|
private java.util.concurrent.atomic.AtomicLong |
messagesInChannels
|
private OperatorStateMonitor |
monitor
|
private DataflowProcessor |
processor
|
private boolean |
shutdownFlag
|
| Constructor Summary | |
|---|---|
GracefulShutdownListener(OperatorStateMonitor monitor)
Hooks hooks the shared monitor |
|
| Method Summary | |
|---|---|
void |
afterRun(DataflowProcessor processor,
java.util.List<java.lang.Object> messages)
Enters an idle state, so a notification needs to be sent to the monitor. |
java.util.List<java.lang.Object> |
beforeRun(DataflowProcessor processor,
java.util.List<java.lang.Object> messages)
Entering a different non-idle state, so a notification needs to be sent to the monitor. |
java.lang.Object |
controlMessageArrived(DataflowProcessor processor,
DataflowReadChannel<java.lang.Object> channel,
int index,
java.lang.Object message)
Entering a non-idle state, so a notification needs to be sent to the monitor. |
private void |
fireEvent()
If shutdown is in progress, we'll notify the monitor |
(package private) void |
initiateShutdown()
Starts the shutdown phase by turning shutdownFlag on |
boolean |
isIdle()
A quick check on, whether the operator/selector is in the Idle state |
boolean |
isIdleAndNoIncomingMessages()
A more sophisticated test for being Idle |
java.lang.Object |
messageArrived(DataflowProcessor processor,
DataflowReadChannel<java.lang.Object> channel,
int index,
java.lang.Object message)
Entering a non-idle state, so a notification needs to be sent to the monitor. |
void |
registered(DataflowProcessor processor)
When hooked into an operator/selectors, the listener will tap to its input channels to get notified about all incoming messages. |
(package private) void |
terminateProcessor()
Used by the monitor to terminate the underlying operator/selector |
| Methods inherited from class groovyx.gpars.dataflow.operator.DataflowEventAdapter |
|---|
afterStart, afterStop, customEvent, messageSentOut, onException |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private boolean collectingMessages
private final java.util.concurrent.atomic.AtomicInteger activeForks
private final OperatorStateMonitor monitor
private DataflowProcessor processor
private volatile boolean shutdownFlag
private final java.util.concurrent.atomic.AtomicLong messagesInChannels
| Constructor Detail |
|---|
public GracefulShutdownListener(OperatorStateMonitor monitor)
monitor - The monitor that will orchestrate the shutdown| Method Detail |
|---|
public void registered(DataflowProcessor processor)
registered in interface DataflowEventListenerregistered in class DataflowEventAdapterprocessor - The reporting dataflow operator/selector
public java.lang.Object messageArrived(DataflowProcessor processor,
DataflowReadChannel<java.lang.Object> channel,
int index,
java.lang.Object message)
messageArrived in interface DataflowEventListenermessageArrived in class DataflowEventAdapterprocessor - The reporting dataflow operator/selectorchannel - The input channel holding the messageindex - The index of the input channel within the operatormessage - The incoming message
public java.lang.Object controlMessageArrived(DataflowProcessor processor,
DataflowReadChannel<java.lang.Object> channel,
int index,
java.lang.Object message)
controlMessageArrived in interface DataflowEventListenercontrolMessageArrived in class DataflowEventAdapterprocessor - The reporting dataflow operator/selectorchannel - The input channel holding the messageindex - The index of the input channel within the operatormessage - The incoming message
public java.util.List<java.lang.Object> beforeRun(DataflowProcessor processor,
java.util.List<java.lang.Object> messages)
beforeRun in interface DataflowEventListenerbeforeRun in class DataflowEventAdapterprocessor - The reporting dataflow operator/selectormessages - The incoming messages
public void afterRun(DataflowProcessor processor,
java.util.List<java.lang.Object> messages)
afterRun in interface DataflowEventListenerafterRun in class DataflowEventAdapterprocessor - The reporting dataflow operator/selectormessages - The incoming messages that have been processedprivate void fireEvent()
final void initiateShutdown()
public final boolean isIdle()
public final boolean isIdleAndNoIncomingMessages()
final void terminateProcessor()
|
Copyright © 2008–2013 Václav Pech. All Rights Reserved. | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||