Github user franz1981 commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/2488#discussion_r244984864
--- Diff:
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java
---
@@ -3080,45 +3053,20 @@ private boolean deliverDirect(final
MessageReference ref) {
return true;
}
- int startPos = pos;
-
- int size = consumerList.size();
+ consumers.reset();
- while (true) {
- ConsumerHolder<? extends Consumer> holder;
- if (redistributor == null) {
- holder = consumerList.get(pos);
- } else {
- holder = redistributor;
- }
+ while (consumers.hasNext() || redistributor != null) {
--- End diff --
Just thinking loud: given that `consumers::hasNext` is mostly used with a
`next` after it, why not provide just a `pollNext` method that return the
consumer or `null` if there isn't any?
---