|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.dataflow.operator.DataflowEventAdapter groovyx.gpars.dataflow.operator.component.GracefulShutdownListener
public class GracefulShutdownListener extends DataflowEventAdapter
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)
|
Method Summary | |
---|---|
void
|
afterRun(DataflowProcessor processor, java.util.List messages)
If shutdown is in progress, we'll notify the monitor |
java.util.List
|
beforeRun(DataflowProcessor processor, java.util.List messages)
Enters an idle state, so a notification needs to be sent to the monitor. |
java.lang.Object
|
controlMessageArrived(DataflowProcessor processor, DataflowReadChannel channel, int index, java.lang.Object message)
Entering a different non-idle state, so a notification needs to be sent to the monitor. |
private void
|
fireEvent()
A quick check on, whether the operator/selector is in the Idle state |
void
|
initiateShutdown()
|
boolean
|
isIdle()
|
boolean
|
isIdleAndNoIncomingMessages()
|
java.lang.Object
|
messageArrived(DataflowProcessor processor, DataflowReadChannel channel, int index, java.lang.Object message)
|
void
|
registered(DataflowProcessor processor)
|
void
|
terminateProcessor()
|
Methods inherited from class DataflowEventAdapter | |
---|---|
afterRun, afterStart, afterStop, beforeRun, controlMessageArrived, customEvent, messageArrived, messageSentOut, onException, registered |
Field Detail |
---|
private final java.util.concurrent.atomic.AtomicInteger activeForks
private boolean collectingMessages
private final java.util.concurrent.atomic.AtomicLong messagesInChannels
private final OperatorStateMonitor monitor
private DataflowProcessor processor
private boolean shutdownFlag
Constructor Detail |
---|
public GracefulShutdownListener(OperatorStateMonitor monitor)
Method Detail |
---|
@java.lang.Override*/ public void afterRun(DataflowProcessor processor, java.util.List messages)
@java.lang.OverridefireEvent(); public java.util.List beforeRun(DataflowProcessor processor, java.util.List messages)
processor
- The reporting dataflow operator/selectormessages
- The incoming messages that have been processed
@java.lang.Overridepublic List
processor
- The reporting dataflow operator/selectormessages
- The incoming messages
private void fireEvent()
final void initiateShutdown()
public final boolean isIdle()
public final boolean isIdleAndNoIncomingMessages()
@java.lang.Override* @return The same object that was passed in as the last argument public java.lang.Object messageArrived(DataflowProcessor processor, DataflowReadChannel channel, int index, java.lang.Object message)
@java.lang.Override* @param channel The input channel holding the message public void registered(DataflowProcessor processor)
final void terminateProcessor()
Copyright © 2008–2013 Václav Pech. All Rights Reserved.