Class OrderedStreamElementQueue<OUT>
- java.lang.Object
-
- org.apache.flink.streaming.api.operators.async.queue.OrderedStreamElementQueue<OUT>
-
- All Implemented Interfaces:
StreamElementQueue<OUT>
@Internal public final class OrderedStreamElementQueue<OUT> extends Object implements StreamElementQueue<OUT>
OrderedStreamElementQueueimplementation. The ordered stream element queue provides asynchronous results in the order in which theStreamElementQueueEntryhave 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 Summary
Constructors Constructor Description OrderedStreamElementQueue(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidemitCompletedElement(org.apache.flink.streaming.api.operators.TimestampedCollector<OUT> output)Emits one completed element from the head of this queue into the given output.booleanhasCompletedElements()Checks if there is at least one completed head element.booleanisEmpty()True if the queue is empty; otherwise false.intsize()Return the size of the queue.Optional<ResultFuture<OUT>>tryPut(org.apache.flink.streaming.runtime.streamrecord.StreamElement streamElement)Tries to put the given element in the queue.List<org.apache.flink.streaming.runtime.streamrecord.StreamElement>values()Returns the collection ofStreamElementcurrently contained in this queue for checkpointing.
-
-
-
Method Detail
-
hasCompletedElements
public boolean hasCompletedElements()
Description copied from interface:StreamElementQueueChecks if there is at least one completed head element.- Specified by:
hasCompletedElementsin interfaceStreamElementQueue<OUT>- Returns:
- True if there is a completed head element.
-
emitCompletedElement
public void emitCompletedElement(org.apache.flink.streaming.api.operators.TimestampedCollector<OUT> output)
Description copied from interface:StreamElementQueueEmits one completed element from the head of this queue into the given output.Will not emit any element if no element has been completed (check
StreamElementQueue.hasCompletedElements()before entering any critical section).- Specified by:
emitCompletedElementin interfaceStreamElementQueue<OUT>- Parameters:
output- the output into which to emit
-
values
public List<org.apache.flink.streaming.runtime.streamrecord.StreamElement> values()
Description copied from interface:StreamElementQueueReturns the collection ofStreamElementcurrently contained in this queue for checkpointing.This includes all non-emitted, completed and non-completed elements.
- Specified by:
valuesin interfaceStreamElementQueue<OUT>- Returns:
- List of currently contained
StreamElement.
-
isEmpty
public boolean isEmpty()
Description copied from interface:StreamElementQueueTrue if the queue is empty; otherwise false.- Specified by:
isEmptyin interfaceStreamElementQueue<OUT>- Returns:
- True if the queue is empty; otherwise false.
-
size
public int size()
Description copied from interface:StreamElementQueueReturn the size of the queue.- Specified by:
sizein interfaceStreamElementQueue<OUT>- Returns:
- The number of elements contained in this queue.
-
tryPut
public Optional<ResultFuture<OUT>> tryPut(org.apache.flink.streaming.runtime.streamrecord.StreamElement streamElement)
Description copied from interface:StreamElementQueueTries to put the given element in the queue. This operation succeeds if the queue has capacity left and fails if the queue is full.This method returns a handle to the inserted element that allows to set the result of the computation.
- Specified by:
tryPutin interfaceStreamElementQueue<OUT>- Parameters:
streamElement- the element to be inserted.- Returns:
- A handle to the element if successful or
Optional.empty()otherwise.
-
-