Github user michaelandrepearce commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/2488#discussion_r245008661 --- 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 -- Trying to keep to standard interfaces, this is the standard Iterator methods. Also at this point in the while we do not want to actually get the next, theres some timeouts and other checks needed to be done first, thus next is called a little later on.
---