public interface QueueConsumer<E>
Modifier and Type | Method and Description |
---|---|
E |
cancellablePoll(java.time.Duration timeout)
Retrieves and removes the head of this queue, waiting up to the specified wait time if
necessary for an element to become available.
|
E |
cancellableTake()
Retrieves and removes the head of this queue, waiting if necessary until an element becomes
available.
|
<R> QueueConsumer<R> |
map(Functions.Func1<? super E,? extends R> mapper)
Returns a queue consisting of the results of applying the given function to the elements of
this queue.
|
E |
peek()
Retrieves the head of this queue keeping it in the queue if it is not empty without blocking.
|
E |
poll()
Retrieves and removes the head of this queue if it is not empty without blocking.
|
E |
poll(java.time.Duration timeout)
Retrieves and removes the head of this queue, waiting up to the specified wait time if
necessary for an element to become available.
|
E |
take()
Retrieves and removes the head of this queue, waiting if necessary until an element becomes
available.
|
E take()
cancellableTake()
instead.E cancellableTake()
CanceledFailure
- if surrounding @CancellationScope
is
canceled while waitingE poll()
null
if the queue is emptyE peek()
null
if the queue is emptyE poll(java.time.Duration timeout)
cancellablePoll(Duration)
instead.timeout
- how long to wait before giving up.null
if the specified waiting time elapses before an
element is availableE cancellablePoll(java.time.Duration timeout)
timeout
- how long to wait before giving upnull
if the specified waiting time elapses before an
element is availableCanceledFailure
- if surrounding @CancellationScope
is
canceled while waiting<R> QueueConsumer<R> map(Functions.Func1<? super E,? extends R> mapper)
mapper
- a non-interfering, stateless function to apply to each element