|
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 groovyx.gpars.dataflow.LazyDataflowVariable
@java.lang.SuppressWarnings*/ public final class LazyDataflowVariable extends DataflowVariable
Represents a thread-safe single-assignment, multi-read variable with delayed initialization. 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 DataflowVariableField Summary | |
---|---|
private PGroup |
group
|
private java.util.concurrent.atomic.AtomicBoolean |
initializationStarted
|
private groovy.lang.Closure |
initializer
|
Fields inherited from class DataflowVariable | |
---|---|
serialVersionUID |
Fields inherited from class WithSerialId | |
---|---|
serialHandle, serialVersionUID |
Constructor Summary | |
LazyDataflowVariable(groovy.lang.Closure initializer)
|
|
LazyDataflowVariable(PGroup group, groovy.lang.Closure initializer)
|
Method Summary | |
---|---|
java.lang.Throwable
|
getError()
Schedule closure to be executed after data became available. |
java.lang.Object
|
getVal()
|
java.lang.Object
|
getVal(long timeout, java.util.concurrent.TimeUnit units)
|
void
|
getValAsync(MessageStream callback)
|
void
|
getValAsync(java.lang.Object attachment, MessageStream callback)
|
private void
|
initialize()
|
boolean
|
isError()
Returns the error bound to the promise |
Promise
|
then(groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
|
Promise
|
then(Pool pool, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
|
Promise
|
then(PGroup group, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
|
void
|
touch()
Checks if the promise is bound to an error |
Methods inherited from class DataflowVariable | |
---|---|
bindDFV, get, get, getError, getRemoteClass, isError, leftShift, leftShift, shouldThrowTimeout, then, then, then, touch |
Methods inherited from class WithSerialId | |
---|---|
createRemoteHandle, getOrCreateSerialHandle, getRemoteClass, writeReplace |
Field Detail |
---|
private final PGroup group
private final java.util.concurrent.atomic.AtomicBoolean initializationStarted
private final groovy.lang.Closure initializer
Constructor Detail |
---|
public LazyDataflowVariable(groovy.lang.Closure initializer)
public LazyDataflowVariable(PGroup group, groovy.lang.Closure initializer)
Method Detail |
---|
@java.lang.Override public final java.lang.Throwable getError()
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.
@java.lang.Overridesuper.getValAsync(callback); public java.lang.Object getVal()
@java.lang.Overridesuper.getValAsync(attachment, callback); public java.lang.Object getVal(long timeout, java.util.concurrent.TimeUnit units)
@java.lang.Override public void getValAsync(MessageStream callback)
@java.lang.Override public void getValAsync(java.lang.Object attachment, MessageStream callback)
private void initialize()
@java.lang.Overridereturn super.getError(); public final boolean isError()
@java.lang.Override*/ public final Promise then(groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
@java.lang.Override*/ public final Promise then(Pool pool, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
@java.lang.Overridereturn super.getVal(timeout, units); public final Promise then(PGroup group, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)
@java.lang.Override} public void touch()
Copyright © 2008–2013 Václav Pech. All Rights Reserved.