1 18 package org.apache.activemq.broker.region.policy; 19 20 21 import java.util.Iterator ; 22 import java.util.List ; 23 import org.apache.activemq.broker.region.MessageReference; 24 import org.apache.activemq.broker.region.Subscription; 25 import org.apache.activemq.filter.MessageEvaluationContext; 26 27 34 public class StrictOrderDispatchPolicy implements DispatchPolicy { 35 36 44 public boolean dispatch(MessageReference node, MessageEvaluationContext msgContext, List consumers) throws Exception { 45 synchronized(consumers) { 48 int count = 0; 49 for (Iterator iter = consumers.iterator(); iter.hasNext();) { 50 Subscription sub = (Subscription) iter.next(); 51 52 if (!sub.matches(node, msgContext)) 54 continue; 55 56 sub.add(node); 57 count++; 58 } 59 return count > 0; 60 } 61 } 62 63 } 64 | Popular Tags |