Package com.seeq.link.agent
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>
Represents a thread-safe first in-first out (FIFO) collection that will automatically de-queue if it overflows
its fixed size.
-
Constructor Summary
ConstructorsConstructorDescriptionFixedSizeConcurrentQueue
(int fixedSize) Initializes a new instance of the ConcurrentLinkedQueue class. -
Method Summary
Modifier and TypeMethodDescriptiondequeue()
Retrieves and removes the head of this queue, or returns null if this queue is empty.void
Adds an object to the end of the ConcurrentLinkedQueue.boolean
Returns true if queue has overflowed at some point since the last time this was called.int
getCount()
Returns the number of items currently in the queue.int
The maximum size of the queue, after which items will be de-queued to make room.iterator()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
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
Adds an object to the end of the ConcurrentLinkedQueue.- Parameters:
item
- The object to add to the end of the ConcurrentLinkedQueue.
-
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
-