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
      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.
    • Method Detail

      • take

        E take()
        Retrieves and removes the head of this queue, waiting if necessary until an element becomes available. It is not unblocked in case of the enclosing * CancellationScope cancellation. Use cancellableTake() instead.
        Returns:
        the head of this queue
      • cancellableTake

        E cancellableTake()
        Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.
        Returns:
        the head of this queue
        Throws:
        CanceledFailure - if surrounding @CancellationScope is canceled while waiting
      • poll

        E poll()
        Retrieves and removes the head of this queue if it is not empty without blocking.
        Returns:
        the head of this queue, or null if the queue is empty
      • peek

        E peek()
        Retrieves the head of this queue keeping it in the queue if it is not empty without blocking.
        Returns:
        the head of this queue, or null if the queue is empty
      • poll

        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. It is not unblocked in case of the enclosing CancellationScope cancellation. Use cancellablePoll(Duration) instead.
        Parameters:
        timeout - how long to wait before giving up.
        Returns:
        the head of this queue, or null if the specified waiting time elapses before an element is available
      • cancellablePoll

        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.
        Parameters:
        timeout - how long to wait before giving up
        Returns:
        the head of this queue, or null if the specified waiting time elapses before an element is available
        Throws:
        CanceledFailure - if surrounding @CancellationScope is canceled 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.