|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovyx.gpars.serial.WithSerialId
groovyx.gpars.dataflow.expression.DataflowExpression
groovyx.gpars.dataflow.DataflowVariable
@SuppressWarnings({"AccessingNonPublicFieldOfAnotherObject", "UnqualifiedStaticUsage"}) public 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.
- Type of values to bind with the DataflowVariableNested Class Summary | |
---|---|
static class |
DataflowVariable.RemoteDataflowVariable
|
Field Summary | |
---|---|
private static long |
serialVersionUID
|
Fields inherited from class DataflowExpression | |
---|---|
ATTACHMENT, RESULT, S_INITIALIZED, S_INITIALIZING, S_NOT_INITIALIZED, dummyWaitingThread, metaClass, serialVersionUID, state, value, waiting |
Fields inherited from class WithSerialId | |
---|---|
serialHandle, serialVersionUID |
Constructor Summary | |
DataflowVariable()
Creates a new unbound Dataflow Variable |
Method Summary | |
---|---|
private DataflowWriteChannel
|
bindDFV(DataflowReadChannel ref)
|
java.lang.Object
|
get()
Retrieves the value of the variable, blocking until a value is available |
java.lang.Object
|
get(long timeout, java.util.concurrent.TimeUnit units)
Retrieves the value of the variable, blocking up to given timeout, if the value has not been assigned yet. |
java.lang.Class
|
getRemoteClass()
|
DataflowWriteChannel
|
leftShift(java.lang.Object value)
Assigns a value to the variable. |
DataflowWriteChannel
|
leftShift(DataflowReadChannel ref)
Assigns a value from one DataflowVariable instance to this variable. |
boolean
|
shouldThrowTimeout()
|
Methods inherited from class DataflowExpression | |
---|---|
DataflowExpression, binaryChoice, binaryChoice, binaryChoice, bind, bindSafely, bindUnique, chainWith, chainWith, chainWith, choice, choice, choice, doBind, doBindImpl, doBindRemote, evaluate, filter, filter, filter, getMetaClass, getProperty, getVal, getVal, getValAsync, getValAsync, handleInterruption, into, into, into, invokeMethod, isBound, join, join, length, merge, merge, merge, merge, merge, merge, notifyRemote, or, or, poll, rightShift, scheduleCallback, separate, separate, separate, setMetaClass, setProperty, split, split, split, split, split, split, subscribe, subscribe, tap, tap, tap, then, then, then, toString, transform, whenBound, whenBound, whenBound, whenBound, wheneverBound, wheneverBound |
Methods inherited from class WithSerialId | |
---|---|
createRemoteHandle, getOrCreateSerialHandle, getRemoteClass, writeReplace |
Field Detail |
---|
private static final long serialVersionUID
Constructor Detail |
---|
public DataflowVariable()
Method Detail |
---|
private DataflowWriteChannel bindDFV(DataflowReadChannel ref)
@Override @SuppressWarnings({"ProhibitedExceptionDeclared"}) public java.lang.Object get()
@Override @SuppressWarnings({"ProhibitedExceptionDeclared"}) public final java.lang.Object get(long timeout, java.util.concurrent.TimeUnit units)
timeout
- The timeout valueunits
- Units for the timeout
@Override @SuppressWarnings({"unchecked", "rawtypes"}) public java.lang.Class getRemoteClass()
@Override public DataflowWriteChannel leftShift(java.lang.Object value)
value
- The value to assign
@Override public DataflowWriteChannel leftShift(DataflowReadChannel ref)
ref
- The DataflowVariable instance the value of which to bind
boolean shouldThrowTimeout()
Copyright © 2008–2012 Václav Pech. All Rights Reserved.