Represents a deterministic dataflow channel. Unlike a DataflowQueue, DataflowStream allows multiple readers each to read all the messages. Essentially, you may think of DataflowStream as a 1 to many communication channel, since when a reader consumes a messages, other readers will still be able to read the message. Also, all messages arrive to all readers in the same order. DataflowStream is implemented as a functional queue, which impacts the API in that users have to traverse the values in the stream themselves. On the other hand in offers handy methods for value filtering or transformation together with interesting performance characteristics. For convenience and for the ability to use DataflowStream with other dataflow constructs, like e.g. operators, you can wrap DataflowStreams with DataflowReadAdapter for read access or DataflowWriteAdapter for write access.
The DataflowStream class is designed for single-threaded producers and consumers. If multiple threads are supposed to read or write values to the stream, their access to the stream must be serialized externally or the adapters should be used.
- Type for values to pass through the streamFields inherited from class | Fields |
---|---|
class StreamCore |
first, rest, wheneverBoundListeners |
Constructor and description |
---|
DataflowStream
() Creates an empty stream |
DataflowStream
(groovy.lang.Closure toBeApplied) Creates a stream while applying the supplied initialization closure to it |
private DataflowStream
(java.util.Collection<MessageStream> wheneverBoundListeners, java.util.Collection<DataflowChannelListener<T>> updateListeners) |
Type | Name and description |
---|---|
protected StreamCore<T> |
createNewStream() A factory method to create new instances of the correct class when needed |
FList<T> |
getRest() Retrieves a DataflowStream representing the rest of this Stream after removing the first element |
java.lang.String |
toString() |
Methods inherited from class | Name |
---|---|
class StreamCore |
addUpdateListener, addUpdateListeners, appendingString, apply, bind, createNewStream, decrementParties, eos, equals, eval, filter, filter, generate, generateNext, getFirst, getFirstDFV, getRest, hashCode, hookWheneverBoundListeners, incrementParties, isEmpty, iterator, leftShift, leftShift, map, map, reduce, reduce, reduce, wheneverBound, wheneverBound |
class java.lang.Object |
java.lang.Object#wait(), java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Creates an empty stream
Creates a stream while applying the supplied initialization closure to it
toBeApplied
- The closure to use for initializationA factory method to create new instances of the correct class when needed
Retrieves a DataflowStream representing the rest of this Stream after removing the first element
Copyright © 2008–2014 Václav Pech. All Rights Reserved.