Class FixedSizeConcurrentQueue<T>

java.lang.Object
com.seeq.link.agent.FixedSizeConcurrentQueue<T>
Type Parameters:
T - The type of the elements contained in the queue
All Implemented Interfaces:
Iterable<T>

public class FixedSizeConcurrentQueue<T> extends Object implements Iterable<T>
Represents a thread-safe first in-first out (FIFO) collection that will automatically de-queue if it overflows its fixed size.
  • Constructor Details

    • FixedSizeConcurrentQueue

      public FixedSizeConcurrentQueue(int fixedSize)
      Initializes a new instance of the ConcurrentLinkedQueue class.
      Parameters:
      fixedSize - The maximum size of the queue, after which items will be de-queued to make room.
  • Method Details

    • getFixedSize

      public int getFixedSize()
      The maximum size of the queue, after which items will be de-queued to make room.
    • enqueue

      public void enqueue(T item)
      Adds an object to the end of the ConcurrentLinkedQueue.
      Parameters:
      item - The object to add to the end of the ConcurrentLinkedQueue.
    • dequeue

      public T dequeue()
      Retrieves and removes the head of this queue, or returns null if this queue is empty.
      Returns:
      the head of this queue, or null if this queue is empty
    • getAndClearOverflowFlag

      public boolean getAndClearOverflowFlag()
      Returns true if queue has overflowed at some point since the last time this was called.
      Returns:
      true if queue has overflowed
    • getCount

      public int getCount()
      Returns the number of items currently in the queue.
      Returns:
      the number of items currently in the queue.
    • iterator

      @NotNull public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>