|
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.SyncDataflowVariable
public final class SyncDataflowVariable extends DataflowVariable
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.
Field Summary | |
---|---|
private static java.lang.String |
ERROR_READING_A_SYNCHRONOUS_CHANNEL
|
private ResizeableCountDownLatch |
parties
|
Fields inherited from class DataflowVariable | |
---|---|
serialVersionUID |
Fields inherited from class WithSerialId | |
---|---|
serialHandle, serialVersionUID |
Constructor Summary | |
SyncDataflowVariable()
|
|
SyncDataflowVariable(int parties)
|
Method Summary | |
---|---|
private void
|
awaitParties()
|
boolean
|
awaitingParties()
|
DataflowReadChannel
|
chainWith(PGroup group, groovy.lang.Closure closure)
|
void
|
decrementParties()
|
protected void
|
doBindImpl(java.lang.Object value)
|
java.lang.Object
|
getVal()
Reads the value of the variable. |
java.lang.Object
|
getVal(long timeout, java.util.concurrent.TimeUnit units)
|
void
|
incrementParties()
Decreases the number of parties required to perform data exchange by one |
DataflowReadChannel
|
merge(PGroup group, java.util.List others, groovy.lang.Closure closure)
|
private void
|
readerIsReady()
|
private boolean
|
readerIsReady(long timeout)
Increases the number of parties required to perform data exchange by one. |
protected void
|
scheduleCallback(java.lang.Object attachment, MessageStream callback)
|
boolean
|
shouldThrowTimeout()
Reports whether the variable is still waiting for parties to arrive for the rendezvous. |
DataflowReadChannel
|
tap(PGroup group, DataflowWriteChannel target)
|
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 static final java.lang.String ERROR_READING_A_SYNCHRONOUS_CHANNEL
private final ResizeableCountDownLatch parties
Constructor Detail |
---|
public SyncDataflowVariable()
public SyncDataflowVariable(int parties)
Method Detail |
---|
private void awaitParties()
public boolean awaitingParties()
@java.lang.OverridepublicDataflowReadChannel merge(final PGroup group, final List > others, final Closure closure) { public DataflowReadChannel chainWith(PGroup group, groovy.lang.Closure closure)
public void decrementParties()
@java.lang.OverridereaderIsReady(); protected void doBindImpl(java.lang.Object value)
@java.lang.Override public java.lang.Object getVal()
timeout
- The timeout valueunits
- Units for the timeout
@java.lang.Override public java.lang.Object getVal(long timeout, java.util.concurrent.TimeUnit units)
public void incrementParties()
@java.lang.OverridereaderIsReady(); public DataflowReadChannel merge(PGroup group, java.util.List others, groovy.lang.Closure closure)
private void readerIsReady()
private boolean readerIsReady(long timeout)
@java.lang.Override protected void scheduleCallback(java.lang.Object attachment, MessageStream callback)
@java.lang.OverridepublicDataflowReadChannel chainWith(final PGroup group, final Closure closure) { boolean shouldThrowTimeout()
@java.lang.Override} public DataflowReadChannel tap(PGroup group, DataflowWriteChannel target)
Copyright © 2008–2013 Václav Pech. All Rights Reserved.