groovyx.gpars.dataflow
Class DataFlowVariable
java.lang.Object
groovyx.gpars.serial.WithSerialId
groovyx.gpars.dataflow.DataFlowExpression
groovyx.gpars.dataflow.DataFlowVariable
- All Implemented Interfaces:
- DataFlowChannel
@SuppressWarnings({"AccessingNonPublicFieldOfAnotherObject", "UnqualifiedStaticUsage"})
class DataFlowVariable
extends DataFlowExpression
Represents a thread-safe single-assignment, multi-read variable.
Each instance of DataFlowVariable can be read repeatedly any time using the 'val' property and assigned once
in its lifetime using the '<<' operator. Reads preceding assignment will be blocked until the value
is assigned.
For actors and Dataflow Operators the asynchronous non-blocking variants of the getValAsync() methods can be used.
They register the request to read a value and will send a message to the actor or operator once the value is available.
- Parameters:
- Type of values to bind with the DataFlowVariable
- Authors:
- Vaclav Pech, Alex Tkachman
Date: Jun 4, 2009
Methods inherited from class DataFlowExpression
|
DataFlowExpression, bind, bindSafely, bindUnique, doBindRemote, evaluate, getMetaClass, getProperty, getVal, getVal, getValAsync, getValAsync, invokeMethod, isBound, join, join, poll, rightShift, setMetaClass, setProperty, subscribe, subscribe, toString, transform, whenBound, whenBound, wheneverBound, wheneverBound |
serialVersionUID
private static final long serialVersionUID
-
DataFlowVariable
public DataFlowVariable()
- Creates a new unbound Dataflow Variable
getRemoteClass
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
public java.lang.Class getRemoteClass()
-
leftShift
@Override
public DataFlowWriteChannel leftShift(T value)
- Assigns a value to the variable. Can only be invoked once on each instance of DataFlowVariable
- Parameters:
value
- The value to assign
leftShift
@Override
public DataFlowWriteChannel leftShift(DataFlowReadChannel ref)
- Assigns a value from one DataFlowVariable instance to this variable.
Can only be invoked once on each instance of DataFlowVariable
- Parameters:
ref
- The DataFlowVariable instance the value of which to bind
Copyright © 2008–2010 Václav Pech. All Rights Reserved.