groovyx.gpars.dataflow
Class DataCallback

java.lang.Object
  extended by groovyx.gpars.serial.WithSerialId
      extended by groovyx.gpars.actor.impl.MessageStream
          extended by groovyx.gpars.dataflow.DataCallback
All Implemented Interfaces:
java.io.Serializable

public final class DataCallback
extends MessageStream

A helper class enabling the 'whenBound()' or 'getValAsync' functionality of a DataflowVariable and DataflowQueue, as well as 'sendAndContinue()' on actors. A task that waits asynchronously on the DFV to be bound. Once the DFV is bound, upon receiving the message the actor runs the supplied closure / code with the DFV value as a parameter.

Author:
Vaclav Pech, Alex Tkachman Date: Sep 13, 2009
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class groovyx.gpars.actor.impl.MessageStream
MessageStream.RemoteMessageStream, MessageStream.SendTo
 
Field Summary
private  groovy.lang.Closure code
           
private  groovyx.gpars.group.PGroup parallelGroup
           
private static long serialVersionUID
           
 
Fields inherited from class groovyx.gpars.serial.WithSerialId
serialHandle
 
Constructor Summary
DataCallback(groovy.lang.Closure code, groovyx.gpars.group.PGroup pGroup)
           
 
Method Summary
 MessageStream send(java.lang.Object message)
          Sends a message back to the DataCallback.
 
Methods inherited from class groovyx.gpars.actor.impl.MessageStream
call, getRemoteClass, leftShift, send, send, sendAndWait, sendAndWait, sendAndWait
 
Methods inherited from class groovyx.gpars.serial.WithSerialId
createRemoteHandle, getOrCreateSerialHandle, writeReplace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

code

private final groovy.lang.Closure code

parallelGroup

private final groovyx.gpars.group.PGroup parallelGroup
Constructor Detail

DataCallback

public DataCallback(groovy.lang.Closure code,
                    groovyx.gpars.group.PGroup pGroup)
Parameters:
code - The closure to run
pGroup - pGroup The parallel group to join
Method Detail

send

public MessageStream send(java.lang.Object message)
Sends a message back to the DataCallback. Will schedule processing the internal closure with the thread pool Registers its parallel group with DataflowExpressions for nested 'whenBound' handlers to use the same group.

Specified by:
send in class MessageStream
Parameters:
message - message to send
Returns:
always return message stream itself

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