@Internal public final class UnorderedStreamElementQueue<OUT> extends Object implements StreamElementQueue<OUT>
StreamElementQueue
. The unordered stream element queue
provides asynchronous results as soon as they are completed. Additionally, it maintains the
watermark-stream record order.
Elements can be logically grouped into different segments separated by watermarks. A segment needs to be completely emitted before entries from a following segment are emitted. Thus, no stream record can be overtaken by a watermark and no watermark can overtake a stream record. However, stream records falling in the same segment between two watermarks can overtake each other (their emission order is not guaranteed).
Constructor and Description |
---|
UnorderedStreamElementQueue(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 Optional<ResultFuture<OUT>> tryPut(StreamElement streamElement)
StreamElementQueue
This 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.public boolean hasCompletedElements()
StreamElementQueue
hasCompletedElements
in interface StreamElementQueue<OUT>
public void emitCompletedElement(TimestampedCollector<OUT> output)
StreamElementQueue
Will 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()
StreamElementQueue
StreamElement
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()
StreamElementQueue
isEmpty
in interface StreamElementQueue<OUT>
public int size()
StreamElementQueue
size
in interface StreamElementQueue<OUT>
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.