Interface StreamElementQueue<OUT>
- All Known Implementing Classes:
OrderedStreamElementQueue,UnorderedStreamElementQueue
@Internal
public interface StreamElementQueue<OUT>
Interface for stream element queues for the
AsyncWaitOperator.-
Method Summary
Modifier and TypeMethodDescriptionvoidemitCompletedElement(org.apache.flink.streaming.api.operators.TimestampedCollector<OUT> output) Emits one completed element from the head of this queue into the given output.booleanChecks 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.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 Details
-
tryPut
Optional<ResultFuture<OUT>> tryPut(org.apache.flink.streaming.runtime.streamrecord.StreamElement streamElement) Tries 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.
- Parameters:
streamElement- the element to be inserted.- Returns:
- A handle to the element if successful or
Optional.empty()otherwise.
-
emitCompletedElement
void emitCompletedElement(org.apache.flink.streaming.api.operators.TimestampedCollector<OUT> output) Emits 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
hasCompletedElements()before entering any critical section).- Parameters:
output- the output into which to emit
-
hasCompletedElements
boolean hasCompletedElements()Checks if there is at least one completed head element.- Returns:
- True if there is a completed head element.
-
values
List<org.apache.flink.streaming.runtime.streamrecord.StreamElement> values()Returns the collection ofStreamElementcurrently contained in this queue for checkpointing.This includes all non-emitted, completed and non-completed elements.
- Returns:
- List of currently contained
StreamElement.
-
isEmpty
boolean isEmpty()True if the queue is empty; otherwise false.- Returns:
- True if the queue is empty; otherwise false.
-
size
int size()Return the size of the queue.- Returns:
- The number of elements contained in this queue.
-