@Internal public class UnorderedStreamElementQueue extends Object implements StreamElementQueue
StreamElementQueue. The unordered stream element queue
emits asynchronous results as soon as they are completed. Additionally it maintains the
watermark-stream record order. This means that 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,
Executor executor,
OperatorActions operatorActions) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isEmpty()
True if the queue is empty; otherwise false.
|
void |
onCompleteHandler(StreamElementQueueEntry<?> streamElementQueueEntry)
Callback for onComplete events for the given stream element queue entry.
|
AsyncResult |
peekBlockingly()
Peek at the head of the queue and return the first completed
AsyncResult. |
AsyncResult |
poll()
Poll the first completed
AsyncResult from the head of this queue. |
<T> void |
put(StreamElementQueueEntry<T> streamElementQueueEntry)
Put the given element in the queue if capacity is left.
|
int |
size()
Return the size of the queue.
|
<T> boolean |
tryPut(StreamElementQueueEntry<T> streamElementQueueEntry)
Try to put the given element in the queue.
|
Collection<StreamElementQueueEntry<?>> |
values()
Return the collection of
StreamElementQueueEntry currently contained in this queue. |
public UnorderedStreamElementQueue(int capacity,
Executor executor,
OperatorActions operatorActions)
public <T> void put(StreamElementQueueEntry<T> streamElementQueueEntry) throws InterruptedException
StreamElementQueueput in interface StreamElementQueueT - Type of the entries future valuestreamElementQueueEntry - to be put into the queueInterruptedException - if the calling thread has been interrupted while waiting to
insert the given elementpublic <T> boolean tryPut(StreamElementQueueEntry<T> streamElementQueueEntry) throws InterruptedException
StreamElementQueuetryPut in interface StreamElementQueueT - Type of the entries future valuestreamElementQueueEntry - to be insertedInterruptedException - if the calling thread has been interrupted while waiting to
insert the given elementpublic AsyncResult peekBlockingly() throws InterruptedException
StreamElementQueueAsyncResult. This
operation is a blocking operation and only returns once a completed async result has been
found.peekBlockingly in interface StreamElementQueueAsyncResultInterruptedException - if the current thread has been interrupted while waiting for a
completed async result.public AsyncResult poll() throws InterruptedException
StreamElementQueueAsyncResult from the head of this queue. This operation is
blocking and only returns once a completed async result has been found.poll in interface StreamElementQueueAsyncResult which has been removed from the queueInterruptedException - if the current thread has been interrupted while waiting for a
completed async result.public Collection<StreamElementQueueEntry<?>> values() throws InterruptedException
StreamElementQueueStreamElementQueueEntry currently contained in this queue.values in interface StreamElementQueueStreamElementQueueEntry.InterruptedException - if the current thread has been interrupted while retrieving the
stream element queue entries of this queue.public boolean isEmpty()
StreamElementQueueisEmpty in interface StreamElementQueuepublic int size()
StreamElementQueuesize in interface StreamElementQueuepublic void onCompleteHandler(StreamElementQueueEntry<?> streamElementQueueEntry) throws InterruptedException
streamElementQueueEntry - which has been completedInterruptedException - if the current thread has been interrupted while performing the
on complete callback.Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.