Class TerminableQueues

java.lang.Object
org.jtrim2.concurrent.collections.TerminableQueues

public final class TerminableQueues extends Object
Defines factory methods for TerminableQueue.

This class cannot be instantiated or inherited.

  • Method Details

    • withWrappedQueue

      public static <T> TerminableQueue<T> withWrappedQueue(ReservablePollingQueue<T> queue)
      Returns a TerminableQueue using the given ReservablePollingQueue to store elements. The returned TerminableQueue takes ownership of the passed ReservablePollingQueue, and so the calling code may no longer use the passed queue.

      Note: The passed queue does not need to be empty when passed, in which case of course, the returned TerminableQueue will start out with the initial elements of the passed ReservablePollingQueue.

      Type Parameters:
      T - the type of the elements of the created queue
      Parameters:
      queue - the backing queue which the returned TerminableQueue will use. Thus, the element order of the returned TerminableQueue is the same as the given ReservablePollingQueue
      Returns:
      a TerminableQueue using the given ReservablePollingQueue to store elements. This method never returns null.