mirror of https://github.com/apache/activemq.git
removed unnecessary synchronization around dispatch list
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@960444 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
42ee51fe9a
commit
6a5030b9f5
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
package org.apache.activemq.broker.region.policy;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.apache.activemq.broker.region.MessageReference;
|
||||
import org.apache.activemq.broker.region.Subscription;
|
||||
|
@ -31,25 +30,24 @@ import org.apache.activemq.filter.MessageEvaluationContext;
|
|||
*/
|
||||
public class SimpleDispatchPolicy implements DispatchPolicy {
|
||||
|
||||
public boolean dispatch(MessageReference node,MessageEvaluationContext msgContext, List<Subscription> consumers)
|
||||
public boolean dispatch(MessageReference node, MessageEvaluationContext msgContext, List<Subscription> consumers)
|
||||
throws Exception {
|
||||
|
||||
int count = 0;
|
||||
synchronized (consumers) {
|
||||
for (Subscription sub:consumers) {
|
||||
// Don't deliver to browsers
|
||||
if (sub.getConsumerInfo().isBrowser()) {
|
||||
continue;
|
||||
}
|
||||
// Only dispatch to interested subscriptions
|
||||
if (!sub.matches(node, msgContext)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
sub.add(node);
|
||||
count++;
|
||||
for (Subscription sub : consumers) {
|
||||
// Don't deliver to browsers
|
||||
if (sub.getConsumerInfo().isBrowser()) {
|
||||
continue;
|
||||
}
|
||||
// Only dispatch to interested subscriptions
|
||||
if (!sub.matches(node, msgContext)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
sub.add(node);
|
||||
count++;
|
||||
}
|
||||
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue