|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovyx.gpars.serial.WithSerialId
gpars.dataflow.DataFlowExpression
@SuppressWarnings({"UnqualifiedStaticUsage", "CallToSimpleGetterFromWithinClass"}) public abstract class DataFlowExpression extends WithSerialId
The base class for all dataflow elements.
Nested Class Summary | |
---|---|
static class |
DataFlowExpression.BindDataFlow
Represents a remote message binding a value to a remoted DataFlowExpression |
Field Summary | |
---|---|
protected static int |
S_INITIALIZED
|
protected static int |
S_INITIALIZING
|
protected static int |
S_NOT_INITIALIZED
Possible states |
protected int |
state
Holds the current state of the variable |
protected static AtomicIntegerFieldUpdater |
stateUpdater
Updater for the state field |
protected Object |
value
Holds the actual value. |
protected static AtomicReferenceFieldUpdater |
waitingUpdater
Updater for the waiting field |
Method Summary | |
---|---|
protected def
|
DataFlowExpression()
Creates a new unbound Dataflow Expression |
void
|
bind(Object value)
Assigns a value to the variable. |
void
|
bindSafely(Object value)
Assigns a value to the variable. |
void
|
doBindRemote(UUID hostId, Object message)
Binds the value after receiving a bing message over the wire |
protected Object
|
evaluate()
Evaluate expression after the ones we depend on are ready |
groovy.lang.MetaClass
|
getMetaClass()
|
Object
|
getProperty(String propertyName)
Returns either standard property of expression or creates expression, which will request given property when receiver became available |
Object
|
getVal()
Reads the value of the variable. |
Object
|
getVal(long timeout, TimeUnit units)
Reads the value of the variable. |
void
|
getValAsync(MessageStream callback)
Asynchronously retrieves the value of the variable. |
Object
|
invokeMethod(String name, Object args)
|
boolean
|
isBound()
Check if value has been set already for this expression |
void
|
rightShift(groovy.lang.Closure closure)
Schedule closure to be executed by pooled actor after data became available It is important to notice that even if data already available the execution of closure will not happen immediately but will be scheduled |
void
|
setMetaClass(groovy.lang.MetaClass metaClass)
|
void
|
setProperty(String propertyName, Object newValue)
|
protected void
|
subscribe()
Utility method to call at the very end of constructor of derived expressions. |
protected void
|
subscribe(DataFlowExpression.DataFlowExpressionsCollector listener)
|
String
|
toString()
|
static DataFlowExpression
|
transform(Object another, groovy.lang.Closure closure)
|
void
|
whenBound(groovy.lang.Closure closure)
Schedule closure to be executed by pooled actor after data becomes available It is important to notice that even if data already available the execution of closure will not happen immediately but will be scheduled. |
void
|
whenBound(MessageStream stream)
Send the bound data to provided stream when it becomes available |
Field Detail |
---|
protected static final int S_INITIALIZED
protected static final int S_INITIALIZING
protected static final int S_NOT_INITIALIZED
protected int state
protected static final AtomicIntegerFieldUpdater stateUpdater
@SuppressWarnings({"InstanceVariableMayNotBeInitialized"}) protected Object value
protected static final AtomicReferenceFieldUpdater waitingUpdater
Method Detail |
---|
protected def DataFlowExpression()
public void bind(Object value)
value
- The value to assign
public void bindSafely(Object value)
value
- The value to assign
public void doBindRemote(UUID hostId, Object message)
hostId
- Id of the bind originator hostmessage
- The value to bind
protected Object evaluate()
public groovy.lang.MetaClass getMetaClass()
public Object getProperty(String propertyName)
propertyName
- The name of the property to retrieve
public Object getVal()
public Object getVal(long timeout, TimeUnit units)
timeout
- The timeout valueunits
- Units for the timeout
public void getValAsync(MessageStream callback)
callback
- An actor to send the bound value to.
public Object invokeMethod(String name, Object args)
public boolean isBound()
public void rightShift(groovy.lang.Closure closure)
closure
- closure to execute when data available
public void setMetaClass(groovy.lang.MetaClass metaClass)
public void setProperty(String propertyName, Object newValue)
protected final void subscribe()
protected void subscribe(DataFlowExpression.DataFlowExpressionsCollector listener)
@SuppressWarnings({"ArithmeticOnVolatileField"}) @Override public String toString()
@SuppressWarnings("unchecked") public static DataFlowExpression transform(Object another, groovy.lang.Closure closure)
public void whenBound(groovy.lang.Closure closure)
closure
- closure to execute when data available
public void whenBound(MessageStream stream)
stream
- stream where to send result
Groovy Documentation