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 Summary
Constructors Constructor Description QueueConsumersImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(T t)voidforEach(Consumer<? super T> action)Set<Integer>getPriorites()booleanhasNext()booleanisEmpty()Iterator<T>iterator()Tnext()booleanremove(T t)voidremoved(T t)voidrepeat()voidreset()intsize()Spliterator<T>spliterator()Stream<T>stream()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNextin interfaceIterator<T extends PriorityAware>
-
next
public T next()
- Specified by:
nextin interfaceIterator<T extends PriorityAware>
-
repeat
public void repeat()
- Specified by:
repeatin interfaceRepeatableIterator<T extends PriorityAware>
-
reset
public void reset()
- Specified by:
resetin interfaceResettableIterator<T extends PriorityAware>
-
add
public boolean add(T t)
- Specified by:
addin interfaceQueueConsumers<T extends PriorityAware>
-
removed
public void removed(T t)
- Specified by:
removedin interfaceRepeatableIterator<T extends PriorityAware>
-
remove
public boolean remove(T t)
- 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
public Stream<T> stream()
- Specified by:
streamin interfaceQueueConsumers<T extends PriorityAware>
-
iterator
public Iterator<T> iterator()
- Specified by:
iteratorin interfaceIterable<T extends PriorityAware>
-
forEach
public void forEach(Consumer<? super T> action)
- Specified by:
forEachin interfaceIterable<T extends PriorityAware>
-
spliterator
public Spliterator<T> spliterator()
- Specified by:
spliteratorin interfaceIterable<T extends PriorityAware>
-
getPriorites
public Set<Integer> getPriorites()
- Specified by:
getPrioritesin interfaceQueueConsumers<T extends PriorityAware>
-
-