ARTEMIS-856 Fixing MessageRedistributionTest Cleaner code.
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/de465179 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/de465179 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/de465179 Branch: refs/heads/master Commit: de465179e5b0eecc87e6865250e771ce1f603e1b Parents: ddd554f Author: Michael André Pearce <[email protected]> Authored: Thu Aug 2 14:04:59 2018 +0100 Committer: Michael André Pearce <[email protected]> Committed: Thu Aug 2 14:20:03 2018 +0100 ---------------------------------------------------------------------- .../activemq/artemis/core/server/impl/QueueImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/de465179/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java ---------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index 09ff210..1f0c7af 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -2375,7 +2375,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { MessageReference ref; Consumer handledconsumer = null; - SimpleString groupID; + synchronized (this) { // Need to do these checks inside the synchronized @@ -2442,7 +2442,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { // If a group id is set, then this overrides the consumer chosen round-robin - groupID = extractGroupID(ref); + SimpleString groupID = extractGroupID(ref); if (groupID != null) { groupConsumer = groups.get(groupID); @@ -2490,10 +2490,15 @@ public class QueueImpl extends CriticalComponentImpl implements Queue { } } - if (pos == endPos || (redistributor != null || groupConsumer != null || exclusive)) { + if (redistributor != null || groupConsumer != null || exclusive) { + if (noDelivery > 0) { + break; + } + noDelivery = 0; + } else if (pos == endPos) { // Round robin'd all - if (noDelivery == size && redistributor == null || ((redistributor != null || groupConsumer != null || exclusive) && noDelivery > 0)) { + if (noDelivery == size) { if (handledconsumer != null) { // this shouldn't really happen, // however I'm keeping this as an assertion case future developers ever change the logic here on this class
