|
org.codehaus.gpars | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgroovyx.gpars.dataflow.stream.DataFlowStreamWriteAdapter
groovyx.gpars.dataflow.DataFlowBroadcast
class DataFlowBroadcast extends DataFlowStreamWriteAdapter
Offers a deterministic one-to-many and many-to-many messaging alternative to DataFlowQueue. Internally it wraps a DataFlowStream 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
- The type of messages to pass through the streamConstructor Summary | |
DataFlowBroadcast()
Creates a new adapter |
Method Summary | |
---|---|
DataFlowReadChannel
|
createReadChannel()
Retrieves an implementation of DataFlowReadChannel to read all messages submitted to the broadcast chanel. |
java.lang.String
|
toString()
|
Methods inherited from class DataFlowStreamWriteAdapter | |
---|---|
bind, getHead, leftShift, leftShift, toString |
Constructor Detail |
---|
public DataFlowBroadcast()
Method Detail |
---|
public DataFlowReadChannel createReadChannel()
@SuppressWarnings({"SynchronizedMethod"}) @Override public java.lang.String toString()
Copyright © 2008–2010 Václav Pech. All Rights Reserved.