|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovyx.gpars.dataflow.stream.DataflowStreamWriteAdapter<T>
groovyx.gpars.dataflow.SyncDataflowBroadcast<T>
T
- The type of messages to pass through the streampublic final class SyncDataflowBroadcast<T>
Offers a synchronous deterministic one-to-many and many-to-many messaging alternative to SyncDataflowQueue. Internally it wraps a SyncDataflowStream class with a DataflowStreamWriteAdapter and so synchronizes all writes to the underlying stream allowing multiple threads accessing the stream concurrently. On demand through the createReadChannel() method it will return an DataflowReadChannel through which the reader will receive all messages written to the channel since then.
Typical use:
DataflowWriteChannel broadcastStream = new DataflowBroadcast() DataflowReadChannel stream1 = broadcastStream.createReadChannel() DataflowReadChannel stream2 = broadcastStream.createReadChannel() broadcastStream << 'Message' assert stream1.val == stream2.val
Constructor Summary | |
---|---|
SyncDataflowBroadcast()
Creates a new instance |
Method Summary | |
---|---|
DataflowReadChannel<T> |
createReadChannel()
Retrieves an implementation of DataflowReadChannel to read all messages submitted to the broadcast chanel. |
java.lang.String |
toString()
|
void |
unsubscribeReadChannel(DataflowReadChannel<T> channel)
Un-registers the supplied read channel from the broadcast. |
Methods inherited from class groovyx.gpars.dataflow.stream.DataflowStreamWriteAdapter |
---|
bind, getHead, leftShift, leftShift |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SyncDataflowBroadcast()
Method Detail |
---|
public java.lang.String toString()
toString
in class DataflowStreamWriteAdapter<T>
public DataflowReadChannel<T> createReadChannel()
public void unsubscribeReadChannel(DataflowReadChannel<T> channel) throws java.lang.InterruptedException
channel
- The channel to unsubscribe. The channel won't be able to read further messages.
java.lang.InterruptedException
- If the thread got interrupted
|
Copyright © 2008–2013 Václav Pech. All Rights Reserved. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |