Interface ConcurrentQueue<V>

  • All Known Implementing Classes:
    ConcurrentQueueBlockingImpl, ConcurrentQueueImpl, ConcurrentQueueNonBlockingImpl

    public interface ConcurrentQueue<V>
    A class that provides a very simply unbounded queue. The main requirement here is that the class support constant time (very fast) deletion of arbitrary elements. An instance of this class must be thread safe, either by locking or by using a wait-free algorithm (preferred). The interface is made as simple is possible to make it easier to produce a wait-free implementation.
    • Method Detail

      • size

        int size()
        Return the number of elements in the queue.
        Returns:
        the number of elements
      • offer

        ConcurrentQueue.Handle<V> offer​(V arg)
        Add a new element to the tail of the queue. Returns a handle for the element in the queue.
        Parameters:
        arg - element to add
        Returns:
        handle for element
      • poll

        ConcurrentQueue.Handle<V> poll()
        Return the handle for the head of the queue. The element is removed from the queue.
        Returns:
        handle for head of queue
      • peek

        ConcurrentQueue.Handle<V> peek()
        Return the handle for the head of the queue. The element is not removed from the queue.
        Returns:
        handle for head of queue