Added optimization to determine the highest priority consumer during addition of subscription.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@473223 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian T. Co 2006-11-10 07:28:27 +00:00
parent 8951023556
commit a8f4f6978c
1 changed files with 7 additions and 2 deletions

View File

@ -82,7 +82,7 @@ public class Queue implements Destination {
protected long garbageSizeBeforeCollection = 1000; protected long garbageSizeBeforeCollection = 1000;
private DispatchPolicy dispatchPolicy = new RoundRobinDispatchPolicy(); private DispatchPolicy dispatchPolicy = new RoundRobinDispatchPolicy();
protected final MessageStore store; protected final MessageStore store;
protected int highestSubscriptionPriority; protected int highestSubscriptionPriority = Integer.MIN_VALUE;
private DeadLetterStrategy deadLetterStrategy = new SharedDeadLetterStrategy(); private DeadLetterStrategy deadLetterStrategy = new SharedDeadLetterStrategy();
private MessageGroupMapFactory messageGroupMapFactory = new MessageGroupHashBucketFactory(); private MessageGroupMapFactory messageGroupMapFactory = new MessageGroupHashBucketFactory();
@ -168,7 +168,12 @@ public class Queue implements Destination {
consumers.add(sub); consumers.add(sub);
} }
highestSubscriptionPriority = calcHighestSubscriptionPriority(); if (sub.getConsumerInfo().getPriority() > highestSubscriptionPriority) {
highestSubscriptionPriority = sub.getConsumerInfo().getPriority();
}
}
//highestSubscriptionPriority = calcHighestSubscriptionPriority();
msgContext.setDestination(destination); msgContext.setDestination(destination);
synchronized (messages) { synchronized (messages) {