@Internal public class OrderedStreamElementQueue extends Object implements StreamElementQueue
StreamElementQueue implementation. The ordered stream element queue emits
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,
Executor executor,
OperatorActions operatorActions) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isEmpty()
True if the queue is empty; otherwise false.
|
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 OrderedStreamElementQueue(int capacity,
Executor executor,
OperatorActions operatorActions)
public 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 <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 elementCopyright © 2014–2019 The Apache Software Foundation. All rights reserved.