ARTEMIS-856 Fixing MessageRedistributionTest

Cleaner code.
This commit is contained in:
Michael André Pearce 2018-08-02 14:04:59 +01:00
parent ddd554f43f
commit de465179e5
1 changed files with 9 additions and 4 deletions

View File

@ -2375,7 +2375,7 @@ public class QueueImpl extends CriticalComponentImpl implements Queue {
MessageReference ref; MessageReference ref;
Consumer handledconsumer = null; Consumer handledconsumer = null;
SimpleString groupID;
synchronized (this) { synchronized (this) {
// Need to do these checks inside the synchronized // 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 // If a group id is set, then this overrides the consumer chosen round-robin
groupID = extractGroupID(ref); SimpleString groupID = extractGroupID(ref);
if (groupID != null) { if (groupID != null) {
groupConsumer = groups.get(groupID); 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 // Round robin'd all
if (noDelivery == size && redistributor == null || ((redistributor != null || groupConsumer != null || exclusive) && noDelivery > 0)) { if (noDelivery == size) {
if (handledconsumer != null) { if (handledconsumer != null) {
// this shouldn't really happen, // this shouldn't really happen,
// however I'm keeping this as an assertion case future developers ever change the logic here on this class // however I'm keeping this as an assertion case future developers ever change the logic here on this class