|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovyx.gpars.serial.WithSerialId groovyx.gpars.dataflow.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, stateUpdater, value, waiting, waitingUpdater |
Fields inherited from class WithSerialId | |
---|---|
serialHandle, serialVersionUID |
Constructor Summary | |
DataflowVariable()
Creates a new unbound Dataflow Variable |
Method Summary | |
---|---|
private DataflowWriteChannel
|
bindDFV(DataflowReadChannel ref)
|
T
|
get()
Retrieves the value of the variable, blocking until a value is available |
T
|
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(T value)
Assigns a value to the variable. |
DataflowWriteChannel
|
leftShift(DataflowReadChannel ref)
Assigns a value from one DataflowVariable instance to this variable. |
Methods inherited from class DataflowExpression | |
---|---|
DataflowExpression, bind, bindSafely, bindUnique, doBind, doBindImpl, doBindRemote, evaluate, getMetaClass, getProperty, getVal, getVal, getValAsync, getValAsync, handleInterruption, invokeMethod, isBound, join, join, notifyRemote, poll, rightShift, scheduleCallback, setMetaClass, setProperty, subscribe, subscribe, toString, transform, whenBound, whenBound, whenBound, whenBound, wheneverBound, wheneverBound |
Methods inherited from class WithSerialId | |
---|---|
createRemoteHandle, getOrCreateSerialHandle, getRemoteClass, writeReplace |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
private static final long serialVersionUID
Constructor Detail |
---|
public DataflowVariable()
Method Detail |
---|
private DataflowWriteChannel bindDFV(DataflowReadChannel ref)
@SuppressWarnings({"ProhibitedExceptionDeclared"}) public T get()
@SuppressWarnings({"ProhibitedExceptionDeclared"}) public T 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(T value)
value
- The value to assign
@Override public DataflowWriteChannel leftShift(DataflowReadChannel ref)
ref
- The DataflowVariable instance the value of which to bind
Copyright © 2008–2010 Václav Pech. All Rights Reserved.