org.codehaus.gpars

groovyx.gpars.dataflow
[Java] Class DataflowVariable

java.lang.Object
  groovyx.gpars.serial.WithSerialId
      groovyx.gpars.dataflow.expression.DataflowExpression
          groovyx.gpars.dataflow.DataflowVariable
All Implemented Interfaces:
DataflowChannel, Promise

@java.lang.SuppressWarnings@Override
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.

Parameters:
- Type of values to bind with the DataflowVariable
Authors:
Vaclav Pech, Alex Tkachman Date: Jun 4, 2009


Nested Class Summary
static class DataflowVariable.RemoteDataflowVariable

 
Field Summary
private static long serialVersionUID

 
Fields inherited from class DataflowExpression
ATTACHMENT, A_DATAFLOW_VARIABLE_CAN_ONLY_BE_ASSIGNED_ONCE_ONLY_RE_ASSIGNMENTS_TO_AN_EQUAL_VALUE_ARE_ALLOWED, CANNOT_FIRE_BIND_ERRORS_THE_THREAD_HAS_BEEN_INTERRUPTED, 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()

 
Method Summary
private DataflowWriteChannel bindDFV(DataflowReadChannel ref)

java.lang.Object get()

java.lang.Object get(long timeout, java.util.concurrent.TimeUnit units)

java.lang.Throwable getError()

java.lang.Class getRemoteClass()

boolean isError()

DataflowWriteChannel leftShift(java.lang.Object value)

Assigns a value from one DataflowVariable instance to this variable.

DataflowWriteChannel leftShift(DataflowReadChannel ref)

boolean shouldThrowTimeout()

Checks if the promise is bound to an error

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()

 
Methods inherited from class DataflowExpression
DataflowExpression, binaryChoice, binaryChoice, binaryChoice, binaryChoice, binaryChoice, binaryChoice, bind, bindError, bindSafely, bindUnique, chainWith, chainWith, chainWith, chainWith, chainWith, chainWith, choice, choice, choice, choice, choice, choice, createEventManager, doBind, doBindImpl, doBindRemote, doThenForkAndJoin, evaluate, filter, filter, filter, filter, filter, filter, fireBindError, fireBindError, fireOnMessage, getBindErrorManager, getEventManager, getMetaClass, getProperty, getVal, getVal, getValAsync, getValAsync, handleInterruption, into, into, into, into, into, into, invokeMethod, isBound, join, join, length, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, notifyRemote, or, or, poll, rightShift, scheduleCallback, separate, separate, separate, separate, separate, separate, setMetaClass, setProperty, split, split, split, split, split, split, split, split, split, split, split, split, subscribe, subscribe, tap, tap, tap, tap, tap, tap, then, then, then, thenForkAndJoin, thenForkAndJoin, thenForkAndJoin, toString, transform, whenBound, whenBound, whenBound, whenBound, wheneverBound, wheneverBound
 
Methods inherited from class WithSerialId
createRemoteHandle, getOrCreateSerialHandle, getRemoteClass, writeReplace
 

Field Detail

serialVersionUID

private static final long serialVersionUID


 
Constructor Detail

DataflowVariable

public DataflowVariable()


 
Method Detail

bindDFV

private DataflowWriteChannel bindDFV(DataflowReadChannel ref)


get

@java.lang.Override*/
@java.lang.SuppressWarnings@Override
public final java.lang.Object get()


get

@java.lang.Overridereturn !this.isBound();
@java.lang.SuppressWarnings}
public final java.lang.Object get(long timeout, java.util.concurrent.TimeUnit units)


getError

@java.lang.Override*
public java.lang.Throwable getError()


getRemoteClass

@java.lang.Override@SuppressWarnings({"unchecked"})
@java.lang.SuppressWarnings@Override
public java.lang.Class getRemoteClass()


isError

@java.lang.Override}
public boolean isError()


leftShift

@java.lang.Overridereturn bindDFV(ref);
public DataflowWriteChannel leftShift(java.lang.Object value)
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


leftShift

@java.lang.Override});
public DataflowWriteChannel leftShift(DataflowReadChannel ref)


shouldThrowTimeout

boolean shouldThrowTimeout()
Checks if the promise is bound to an error
Returns:
True, if an error has been bound


then

@java.lang.Override*/
public Promise then(groovy.lang.Closure closure, groovy.lang.Closure errorHandler)


then

@java.lang.Override*/
public Promise then(Pool pool, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)


then

@java.lang.Overrideprivate boolean disconnected;
public Promise then(PGroup group, groovy.lang.Closure closure, groovy.lang.Closure errorHandler)


touch

@java.lang.Overridepublic  Promise then(final Closure closure, final Closure errorHandler) {
public void touch()


 

Copyright © 2008–2013 Václav Pech. All Rights Reserved.