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