public final class SyncDataflowVariable<T> extends DataflowVariable<T>
DataflowVariable.RemoteDataflowVariable<T>
DataflowExpression.BindDataflow<T>
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
ERROR_READING_A_SYNCHRONOUS_CHANNEL |
private ResizeableCountDownLatch |
parties |
error, S_INITIALIZED, S_INITIALIZING, S_NOT_INITIALIZED, state, value
serialHandle
Constructor and Description |
---|
SyncDataflowVariable()
Creates a new variable, which will never block writers.
|
SyncDataflowVariable(int parties)
Creates a new variable blocking the specified number of readers.
|
Modifier and Type | Method and Description |
---|---|
boolean |
awaitingParties()
Reports whether the variable is still waiting for parties to arrive for the rendezvous.
|
private void |
awaitParties() |
<V> DataflowReadChannel<V> |
chainWith(PGroup group,
groovy.lang.Closure<V> closure)
Creates and attaches a new operator processing values from the channel
|
void |
decrementParties()
Decreases the number of parties required to perform data exchange by one
|
protected void |
doBindImpl(T value) |
T |
getVal()
Reads the value of the variable.
|
T |
getVal(long timeout,
java.util.concurrent.TimeUnit units)
Reads the value of the variable.
|
void |
incrementParties()
Increases the number of parties required to perform data exchange by one.
|
<V> DataflowReadChannel<V> |
merge(PGroup group,
java.util.List<DataflowReadChannel<java.lang.Object>> others,
groovy.lang.Closure<V> closure)
Merges channels together as inputs for a single dataflow operator.
|
private void |
readerIsReady() |
private boolean |
readerIsReady(long timeout) |
protected void |
scheduleCallback(java.lang.Object attachment,
MessageStream callback)
Sends the result back to the actor, which is waiting asynchronously for the value to be bound.
|
(package private) boolean |
shouldThrowTimeout() |
DataflowReadChannel<T> |
tap(PGroup group,
DataflowWriteChannel<T> target)
Taps into the pipeline.
|
get, get, getError, getRemoteClass, isError, leftShift, leftShift, then, then, then, touch
binaryChoice, binaryChoice, binaryChoice, binaryChoice, binaryChoice, binaryChoice, bind, bindError, bindSafely, bindUnique, chainWith, chainWith, chainWith, chainWith, chainWith, choice, choice, choice, choice, choice, choice, doBindRemote, evaluate, filter, filter, filter, filter, filter, filter, getBindErrorManager, getEventManager, getMetaClass, getProperty, getValAsync, getValAsync, into, into, into, into, into, into, invokeMethod, isBound, join, join, length, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, or, or, poll, rightShift, 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, then, then, then, thenForkAndJoin, thenForkAndJoin, thenForkAndJoin, toString, transform, whenBound, whenBound, whenBound, whenBound, wheneverBound, wheneverBound
createRemoteHandle, getOrCreateSerialHandle, writeReplace
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
binaryChoice, binaryChoice, binaryChoice, binaryChoice, binaryChoice, binaryChoice, chainWith, chainWith, chainWith, chainWith, chainWith, choice, choice, choice, choice, choice, choice, filter, filter, filter, filter, filter, filter, getEventManager, getValAsync, getValAsync, into, into, into, into, into, into, isBound, length, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, or, or, rightShift, separate, separate, separate, separate, separate, separate, split, split, split, split, split, split, split, split, split, split, split, split, tap, tap, tap, tap, tap, then, then, then, whenBound, whenBound, whenBound, whenBound
poll, wheneverBound, wheneverBound
bind
isBound, join, join, rightShift, then, then, then, thenForkAndJoin, thenForkAndJoin, thenForkAndJoin, whenBound, whenBound, whenBound, whenBound
private static final java.lang.String ERROR_READING_A_SYNCHRONOUS_CHANNEL
private final ResizeableCountDownLatch parties
public SyncDataflowVariable()
public SyncDataflowVariable(int parties)
parties
- Number of readers that have to match a writer before the message gets transferredprotected void doBindImpl(T value)
doBindImpl
in class DataflowExpression<T>
public T getVal() throws java.lang.InterruptedException
getVal
in interface DataflowReadChannel<T>
getVal
in class DataflowExpression<T>
java.lang.InterruptedException
- If the current thread gets interrupted while waiting for the variable to be boundpublic T getVal(long timeout, java.util.concurrent.TimeUnit units) throws java.lang.InterruptedException
getVal
in interface DataflowReadChannel<T>
getVal
in class DataflowExpression<T>
timeout
- The timeout valueunits
- Units for the timeoutjava.lang.InterruptedException
- If the current thread gets interrupted while waiting for the variable to be boundboolean shouldThrowTimeout()
shouldThrowTimeout
in class DataflowVariable<T>
public boolean awaitingParties()
public <V> DataflowReadChannel<V> chainWith(PGroup group, groovy.lang.Closure<V> closure)
DataflowReadChannel
chainWith
in interface DataflowReadChannel<T>
chainWith
in class DataflowExpression<T>
V
- The type of values returned from the supplied closuregroup
- The PGroup to useclosure
- The function to invoke on all incoming values as part of the new operator's bodypublic DataflowReadChannel<T> tap(PGroup group, DataflowWriteChannel<T> target)
DataflowReadChannel
tap
in interface DataflowReadChannel<T>
tap
in class DataflowExpression<T>
group
- The PGroup to usetarget
- The channel to tap data intopublic <V> DataflowReadChannel<V> merge(PGroup group, java.util.List<DataflowReadChannel<java.lang.Object>> others, groovy.lang.Closure<V> closure)
DataflowReadChannel
merge
in interface DataflowReadChannel<T>
merge
in class DataflowExpression<T>
V
- The type of values passed between the channelsgroup
- The PGroup to useothers
- The channels to merge withclosure
- The function to invoke on all incoming values as part of the new operator's body. The number of arguments to the closure must match the number of input channels.protected void scheduleCallback(java.lang.Object attachment, MessageStream callback)
DataflowExpression
scheduleCallback
in class DataflowExpression<T>
attachment
- An arbitrary object identifying the requestcallback
- The actor to send the message toprivate void readerIsReady()
private void awaitParties()
private boolean readerIsReady(long timeout)
public void incrementParties()
public void decrementParties()