|
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.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, error, eventManager, 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.Throwable
|
getError()
Returns the error bound to the promise |
java.lang.Class
|
getRemoteClass()
|
boolean
|
isError()
Checks if the promise is bound to an error |
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()
|
Promise
|
then(groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
Schedule closure to be executed after data became available. |
Promise
|
then(Pool pool, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
Schedule closure to be executed after data becomes available. |
Promise
|
then(PGroup group, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
Schedule closure to be executed after data becomes available. |
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 public final java.lang.Throwable getError()
@Override @SuppressWarnings({"unchecked", "rawtypes"}) public java.lang.Class getRemoteClass()
@Override public final boolean isError()
@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()
@Override public final Promise then(groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
closure
- closure to execute when data becomes available. The closure should take at most one argument.errorHandler
- closure to execute when an error (instance of Throwable) gets bound. The closure should take at most one argument.
@Override public final Promise then(Pool pool, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
pool
- The thread pool to use for task scheduling for asynchronous message deliveryclosure
- closure to execute when data becomes available. The closure should take at most one argument.errorHandler
- closure to execute when an error (instance of Throwable) gets bound. The closure should take at most one argument.
@Override public final Promise then(PGroup group, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
group
- The PGroup to use for task scheduling for asynchronous message deliveryclosure
- closure to execute when data becomes available. The closure should take at most one argument.errorHandler
- closure to execute when an error (instance of Throwable) gets bound. The closure should take at most one argument.
Copyright © 2008–2012 Václav Pech. All Rights Reserved.