Interface QueueConsumer<E>

All Known Subinterfaces:
WorkflowQueue<E>

public interface QueueConsumer<E>
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available.
    Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.
    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.
    Retrieves the head of this queue keeping it in the queue if it is not empty without blocking.
    Retrieves and removes the head of this queue if it is not empty without blocking.
    poll(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.
    Retrieves and removes the head of this queue, waiting if necessary until an element becomes available.
  • Method Details

    • 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(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(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.