Class SpmcArrayQueue<E>

All Implemented Interfaces:
Iterable<E>, Collection<E>, Queue<E>, MessagePassingQueue<E>

@SuppressAnimalSniffer public final class SpmcArrayQueue<E> extends SpmcArrayQueueL3Pad<E>
  • Constructor Details

    • SpmcArrayQueue

      public SpmcArrayQueue(int capacity)
  • Method Details

    • offer

      public boolean offer(E e)
      Description copied from interface: MessagePassingQueue
      Called from a producer thread subject to the restrictions appropriate to the implementation and according to the Queue.offer(Object) interface.
      Parameters:
      e -
      Returns:
      true if element was inserted into the queue, false iff full
    • poll

      public E poll()
      Description copied from interface: MessagePassingQueue
      Called from the consumer thread subject to the restrictions appropriate to the implementation and according to the Queue.poll() interface.
      Returns:
      a message from the queue if one is available, null iff empty
    • peek

      public E peek()
      Description copied from interface: MessagePassingQueue
      Called from the consumer thread subject to the restrictions appropriate to the implementation and according to the Queue.peek() interface.
      Returns:
      a message from the queue if one is available, null iff empty
    • size

      public int size()
      Description copied from interface: MessagePassingQueue
      This method's accuracy is subject to concurrent modifications happening as the size is estimated and as such is a best effort rather than absolute value. For some implementations this method may be O(n) rather than O(1).
      Specified by:
      size in interface Collection<E>
      Specified by:
      size in interface MessagePassingQueue<E>
      Specified by:
      size in class AbstractCollection<E>
      Returns:
      number of messages in the queue, between 0 and queue capacity or Integer.MAX_VALUE if not bounded
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: MessagePassingQueue
      This method's accuracy is subject to concurrent modifications happening as the observation is carried out.
      Specified by:
      isEmpty in interface Collection<E>
      Specified by:
      isEmpty in interface MessagePassingQueue<E>
      Overrides:
      isEmpty in class AbstractCollection<E>
      Returns:
      true if empty, false otherwise