T - The type of data item in the streampublic class BlockingDroppingBufferedStream<T> extends AbstractStream<T>
Stream with an internal buffer based on a
BlockingDroppingQueue. The use of the BlockingDroppingQueue
allows the stream to potentially drop items that are not consumed at a fast
enough rate (although this depends on the actual
BlockingDroppingQueue).
This class is intended to be used to build Stream implementations
that are connected to external, live data-sources that can potentially
produce data at a rate which exceeds the rate at which the stream can be
processed or consumed.
| Constructor and Description |
|---|
BlockingDroppingBufferedStream(BlockingDroppingQueue<T> buffer)
Construct with the given backing queue
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the stream (make hasNext return false)
|
BlockingDroppingQueue<T> |
getBuffer()
Get the underlying
BlockingDroppingQueue that is used as the
internal buffer. |
boolean |
hasNext() |
T |
next() |
protected void |
register(T obj) |
filter, forEach, forEach, forEach, iterator, map, map, parallelForEach, parallelForEach, remove, transformclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingforEach, spliteratorpublic BlockingDroppingBufferedStream(BlockingDroppingQueue<T> buffer)
buffer - the backing bufferprotected void register(T obj) throws InterruptedException
InterruptedExceptionpublic boolean hasNext()
public void close()
public BlockingDroppingQueue<T> getBuffer()
BlockingDroppingQueue that is used as the
internal buffer.