A synchronous variant of DataflowVariable, which blocks the writer as well as the readers. The synchronous variable ensures a specified number of readers must ask for a value before the writer as well as the readers can continue.
Modifiers | Name | Description |
---|---|---|
private static java.lang.String |
ERROR_READING_A_SYNCHRONOUS_CHANNEL |
|
private ResizeableCountDownLatch |
parties |
Fields inherited from class | Fields |
---|---|
class DataflowVariable |
serialVersionUID |
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, stateUpdater, value, waiting, waitingUpdater |
class WithSerialId |
serialHandle, serialVersionUID |
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. |
Type | Name and description |
---|---|
private void |
awaitParties() |
boolean |
awaitingParties() Reports whether the variable is still waiting for parties to arrive for the rendezvous. |
DataflowReadChannel<V> |
chainWith(PGroup group, groovy.lang.Closure<V> closure) |
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. |
DataflowReadChannel<V> |
merge(PGroup group, java.util.List<DataflowReadChannel<java.lang.Object>> others, groovy.lang.Closure<V> closure) |
private void |
readerIsReady() |
private boolean |
readerIsReady(long timeout) |
protected void |
scheduleCallback(java.lang.Object attachment, MessageStream callback) |
boolean |
shouldThrowTimeout() |
DataflowReadChannel<T> |
tap(PGroup group, DataflowWriteChannel<T> target) |
Creates a new variable, which will never block writers.
Creates a new variable blocking the specified number of readers.
parties
- Number of readers that have to match a writer before the message gets transferredReports whether the variable is still waiting for parties to arrive for the rendezvous.
Decreases the number of parties required to perform data exchange by one
Reads the value of the variable. Blocks, if the value has not been assigned yet.
Reads the value of the variable. Blocks up to given timeout, if the value has not been assigned yet.
timeout
- The timeout valueunits
- Units for the timeoutIncreases the number of parties required to perform data exchange by one.
Copyright © 2008–2014 Václav Pech. All Rights Reserved.