doDispatch():

only apply message to least loaded if target subscription not 
already found

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@629007 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2008-02-19 07:21:50 +00:00
parent 40950bc4b8
commit 8768a04e63
1 changed files with 7 additions and 7 deletions

View File

@ -978,7 +978,6 @@ public class Queue extends BaseDestination implements Task {
} }
private void doDispatch(List<MessageReference> list) throws Exception { private void doDispatch(List<MessageReference> list) throws Exception {
if (list != null) { if (list != null) {
synchronized (consumers) { synchronized (consumers) {
for (MessageReference node : list) { for (MessageReference node : list) {
@ -998,8 +997,8 @@ public class Queue extends BaseDestination implements Task {
} }
} }
} }
if (targets != null) { if (target == null && targets != null) {
// pick the least loaded to add the messag too // pick the least loaded to add the message too
for (Subscription s : targets) { for (Subscription s : targets) {
if (target == null if (target == null
@ -1012,7 +1011,8 @@ public class Queue extends BaseDestination implements Task {
target.add(node); target.add(node);
} }
} }
if (target != null && !dispatchSelector.isExclusiveConsumer(target)) { if (target != null
&& !dispatchSelector.isExclusiveConsumer(target)) {
consumers.remove(target); consumers.remove(target);
consumers.add(target); consumers.add(target);
} }