@Internal public final class OrderedStreamElementQueue<OUT> extends Object implements StreamElementQueue<OUT>
StreamElementQueue implementation. The ordered stream element queue provides
asynchronous results in the order in which the StreamElementQueueEntry have been added to
the queue. Thus, even if the completion order can be arbitrary, the output order strictly follows
the insertion order (element cannot overtake each other).| Constructor and Description |
|---|
OrderedStreamElementQueue(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
emitCompletedElement(TimestampedCollector<OUT> output)
Emits one completed element from the head of this queue into the given output.
|
boolean |
hasCompletedElements()
Checks if there is at least one completed head element.
|
boolean |
isEmpty()
True if the queue is empty; otherwise false.
|
int |
size()
Return the size of the queue.
|
Optional<ResultFuture<OUT>> |
tryPut(StreamElement streamElement)
Tries to put the given element in the queue.
|
List<StreamElement> |
values()
Returns the collection of
StreamElement currently contained in this queue for
checkpointing. |
public boolean hasCompletedElements()
StreamElementQueuehasCompletedElements in interface StreamElementQueue<OUT>public void emitCompletedElement(TimestampedCollector<OUT> output)
StreamElementQueueWill not emit any element if no element has been completed (check StreamElementQueue.hasCompletedElements() before entering any critical section).
emitCompletedElement in interface StreamElementQueue<OUT>output - the output into which to emitpublic List<StreamElement> values()
StreamElementQueueStreamElement currently contained in this queue for
checkpointing.
This includes all non-emitted, completed and non-completed elements.
values in interface StreamElementQueue<OUT>StreamElement.public boolean isEmpty()
StreamElementQueueisEmpty in interface StreamElementQueue<OUT>public int size()
StreamElementQueuesize in interface StreamElementQueue<OUT>public Optional<ResultFuture<OUT>> tryPut(StreamElement streamElement)
StreamElementQueueThis method returns a handle to the inserted element that allows to set the result of the computation.
tryPut in interface StreamElementQueue<OUT>streamElement - the element to be inserted.Optional.empty() otherwise.Copyright © 2014–2025 The Apache Software Foundation. All rights reserved.