org.codehaus.gpars

groovyx.gpars.dataflow
[Java] Class DataCallbackWithPool

java.lang.Object
  groovyx.gpars.serial.WithSerialId
      groovyx.gpars.actor.impl.MessageStream
          groovyx.gpars.dataflow.DataCallbackWithPool

public final class DataCallbackWithPool
extends MessageStream

A helper class enabling the 'whenBound()' or 'getValAsync' functionality of a DataflowVariable and DataflowQueue, whenever a thread pool instead of a PGroup is specified.. 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.

Authors:
Vaclav Pech, Alex Tkachman Date: Sep 13, 2009


Field Summary
private groovy.lang.Closure code

private Pool pool

private static long serialVersionUID

 
Fields inherited from class MessageStream
serialVersionUID
 
Fields inherited from class WithSerialId
serialHandle, serialVersionUID
 
Constructor Summary
DataCallbackWithPool(Pool pool, groovy.lang.Closure code)

@param pool The thread pool to schedule on

 
Method Summary
MessageStream send(java.lang.Object message)

Sends a message back to the DataCallback.

 
Methods inherited from class MessageStream
call, getRemoteClass, leftShift, reInterrupt, send, send, send, sendAndWait, sendAndWait, sendAndWait
 
Methods inherited from class WithSerialId
createRemoteHandle, getOrCreateSerialHandle, getRemoteClass, writeReplace
 

Field Detail

code

private final groovy.lang.Closure code


pool

private final Pool pool


serialVersionUID

private static final long serialVersionUID


 
Constructor Detail

DataCallbackWithPool

public DataCallbackWithPool(Pool pool, groovy.lang.Closure code)
Parameters:
pool - The thread pool to schedule on
code - The closure to run


 
Method Detail

send

@Override
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.


 

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