Package com.uber.cadence.workflow
Interface QueueConsumer<E>
-
- All Known Subinterfaces:
WorkflowQueue<E>
public interface QueueConsumer<E>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <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
poll(long timeout, java.util.concurrent.TimeUnit unit)
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.
-
-
-
Method Detail
-
take
E take() throws java.lang.InterruptedException
Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.- Returns:
- the head of this queue
- Throws:
java.lang.InterruptedException
- if interrupted while waiting
-
poll
E poll(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.- Parameters:
timeout
- how long to wait before giving up, in units ofunit
unit
- aTimeUnit
determining how to interpret thetimeout
parameter- Returns:
- the head of this queue, or
null
if the specified waiting time elapses before an element is available - Throws:
java.lang.InterruptedException
- if interrupted while waiting
-
map
<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.- Parameters:
mapper
- a non-interfering, stateless function to apply to each element- Returns:
- the new queue backed by this one.
-
-