本文整理汇总了Java中org.apache.activemq.broker.region.Subscription.unmatched方法的典型用法代码示例。如果您正苦于以下问题:Java Subscription.unmatched方法的具体用法?Java Subscription.unmatched怎么用?Java Subscription.unmatched使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.activemq.broker.region.Subscription
的用法示例。
在下文中一共展示了Subscription.unmatched方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dispatch
import org.apache.activemq.broker.region.Subscription; //导入方法依赖的package包/类
public boolean dispatch(MessageReference node, MessageEvaluationContext msgContext, List<Subscription> consumers)
throws Exception {
int count = 0;
for (Subscription sub : consumers) {
// Don't deliver to browsers
if (sub.getConsumerInfo().isBrowser()) {
continue;
}
// Only dispatch to interested subscriptions
if (!sub.matches(node, msgContext)) {
sub.unmatched(node);
continue;
}
sub.add(node);
count++;
}
return count > 0;
}
示例2: dispatch
import org.apache.activemq.broker.region.Subscription; //导入方法依赖的package包/类
/**
* @param node
* @param msgContext
* @param consumers
* @return true if dispatched
* @throws Exception
* @see org.apache.activemq.broker.region.policy.DispatchPolicy#dispatch(org.apache.activemq.broker.region.MessageReference,
* org.apache.activemq.filter.MessageEvaluationContext, java.util.List)
*/
public boolean dispatch(MessageReference node, MessageEvaluationContext msgContext, List consumers) throws Exception {
// Big synch here so that only 1 message gets dispatched at a time.
// Ensures
// Everyone sees the same order.
synchronized (consumers) {
int count = 0;
for (Iterator iter = consumers.iterator(); iter.hasNext();) {
Subscription sub = (Subscription)iter.next();
// Only dispatch to interested subscriptions
if (!sub.matches(node, msgContext)) {
sub.unmatched(node);
continue;
}
sub.add(node);
count++;
}
return count > 0;
}
}
示例3: dispatch
import org.apache.activemq.broker.region.Subscription; //导入方法依赖的package包/类
/**
* @param node
* @param msgContext
* @param consumers
* @return true if dispatched
* @throws Exception
* @see org.apache.activemq.broker.region.policy.DispatchPolicy#dispatch(org.apache.activemq.broker.region.MessageReference,
* org.apache.activemq.filter.MessageEvaluationContext, java.util.List)
*/
public boolean dispatch(MessageReference node,
MessageEvaluationContext msgContext, List<Subscription> consumers)
throws Exception {
int count = 0;
Subscription firstMatchingConsumer = null;
synchronized (consumers) {
for (Iterator<Subscription> iter = consumers.iterator(); iter
.hasNext();) {
Subscription sub = iter.next();
// Only dispatch to interested subscriptions
if (!sub.matches(node, msgContext)) {
sub.unmatched(node);
continue;
}
if (firstMatchingConsumer == null) {
firstMatchingConsumer = sub;
}
sub.add(node);
count++;
}
if (firstMatchingConsumer != null) {
// Rotate the consumer list.
try {
consumers.remove(firstMatchingConsumer);
consumers.add(firstMatchingConsumer);
} catch (Throwable bestEffort) {
}
}
}
return count > 0;
}