当前位置: 首页>>代码示例>>Java>>正文


Java Subscription.unmatched方法代码示例

本文整理汇总了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;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:22,代码来源:SimpleDispatchPolicy.java

示例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;
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:31,代码来源:StrictOrderDispatchPolicy.java

示例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;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:46,代码来源:RoundRobinDispatchPolicy.java


注:本文中的org.apache.activemq.broker.region.Subscription.unmatched方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。