Class QueueConsumersImpl<T extends PriorityAware>
java.lang.Object
org.apache.activemq.artemis.core.server.impl.QueueConsumersImpl<T>
- Type Parameters:
T- The type this class may hold, this is generic as can be anything that extends PriorityAware, but intent is this is the QueueImpl:ConsumerHolder.
- All Implemented Interfaces:
Iterable<T>,Iterator<T>,QueueConsumers<T>,RepeatableIterator<T>,ResettableIterator<T>
public class QueueConsumersImpl<T extends PriorityAware>
extends Object
implements QueueConsumers<T>
This class's purpose is to hold the consumers.
CopyOnWriteArraySet is used as the underlying collection to the PriorityCollection, as it is concurrent safe, but also lock less for a read path, which is our HOT path. Also it was the underlying collection previously used in QueueImpl, before we abstracted it out to support priority consumers.
There can only be one resettable iterable view, A new iterable view is created on modification, this is to keep the read HOT path performent, BUT the iterable view changes only after reset so changes in the underlying collection are only seen after a reset,
All other iterators created by iterators() method are not reset-able and are created on delegating iterator().
-
Constructor Details
-
QueueConsumersImpl
public QueueConsumersImpl()
-
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceIterator<T extends PriorityAware>
-
next
- Specified by:
nextin interfaceIterator<T extends PriorityAware>
-
repeat
public void repeat()Description copied from interface:RepeatableIteratorIf the current value should repeat.- Specified by:
repeatin interfaceRepeatableIterator<T extends PriorityAware>
-
reset
public void reset()Description copied from interface:ResettableIteratorResets the iterator so that you can iterate over all elements from your current position. Your current position (when reached again) signals the end of iteration as if the collection is circular.- Specified by:
resetin interfaceResettableIterator<T extends PriorityAware>
-
add
- Specified by:
addin interfaceQueueConsumers<T extends PriorityAware>
-
removed
- Specified by:
removedin interfaceRepeatableIterator<T extends PriorityAware>
-
remove
- Specified by:
removein interfaceQueueConsumers<T extends PriorityAware>
-
size
public int size()- Specified by:
sizein interfaceQueueConsumers<T extends PriorityAware>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceQueueConsumers<T extends PriorityAware>
-
stream
- Specified by:
streamin interfaceQueueConsumers<T extends PriorityAware>
-
iterator
- Specified by:
iteratorin interfaceIterable<T extends PriorityAware>
-
forEach
- Specified by:
forEachin interfaceIterable<T extends PriorityAware>
-
spliterator
- Specified by:
spliteratorin interfaceIterable<T extends PriorityAware>
-
getPriorites
- Specified by:
getPrioritesin interfaceQueueConsumers<T extends PriorityAware>
-