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


Java PackageConflictDetect.detectFastjson方法代码示例

本文整理汇总了Java中com.alibaba.rocketmq.common.conflict.PackageConflictDetect.detectFastjson方法的典型用法代码示例。如果您正苦于以下问题:Java PackageConflictDetect.detectFastjson方法的具体用法?Java PackageConflictDetect.detectFastjson怎么用?Java PackageConflictDetect.detectFastjson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.rocketmq.common.conflict.PackageConflictDetect的用法示例。


在下文中一共展示了PackageConflictDetect.detectFastjson方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: start

import com.alibaba.rocketmq.common.conflict.PackageConflictDetect; //导入方法依赖的package包/类
public void start() throws MQClientException {
    PackageConflictDetect.detectFastjson();

    synchronized (this) {
        switch (this.serviceState) {
        case CREATE_JUST:
            this.serviceState = ServiceState.START_FAILED;
            // If not specified,looking address from name server
            if (null == this.clientConfig.getNamesrvAddr()) {
                this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
            }
            // Start request-response channel
            this.mQClientAPIImpl.start();
            // Start various schedule tasks
            this.startScheduledTask();
            // Start pull service
            this.pullMessageService.start();
            // Start rebalance service
            this.rebalanceService.start();
            // Start push service
            this.defaultMQProducer.getDefaultMQProducerImpl().start(false);
            log.info("the client factory [{}] start OK", this.clientId);
            this.serviceState = ServiceState.RUNNING;
            break;
        case RUNNING:
            break;
        case SHUTDOWN_ALREADY:
            break;
        case START_FAILED:
            throw new MQClientException("The Factory object[" + this.getClientId() + "] has been created before, and failed.", null);
        default:
            break;
        }
    }
}
 
开发者ID:y123456yz,项目名称:reading-and-annotate-rocketmq-3.4.6,代码行数:36,代码来源:MQClientInstance.java

示例2: start

import com.alibaba.rocketmq.common.conflict.PackageConflictDetect; //导入方法依赖的package包/类
/**
 * 启动客户端代理
 *
 * @throws MQClientException
 */
public void start() throws MQClientException {
    /**
     * 检查fastjson版本是否有问题
     */
    PackageConflictDetect.detectFastjson();

    synchronized (this) {
        switch (this.serviceState) {
            case CREATE_JUST:
                this.serviceState = ServiceState.START_FAILED;

                /**
                 * 如果没有指定Nameserver的地址,则通过指定的http服务获取
                 */
                // If not specified,looking address from name server
                if (null == this.clientConfig.getNamesrvAddr()) {

                    //这里设置了clientConfig的namesr字段,但是没有返回去设置consumer的,所以启动之后
                    //如果通过consumer.getNamesrvaddr()获取是获取不到的
                    this.clientConfig.setNamesrvAddr(this.mQClientAPIImpl.fetchNameServerAddr());
                }

                /**
                 * 启动与broker和nameserv的通信实例
                 */
                // Start request-response channel
                this.mQClientAPIImpl.start();

                // Start various schedule tasks
                this.startScheduledTask();

                // Start pull service
                this.pullMessageService.start();

                // Start rebalance service
                this.rebalanceService.start();

                /**
                 * 为什么消费者端也要启动一个Producer?
                 * 因为当消费失败的时候,需要把消息发回去
                 */
                // Start push service
                this.defaultMQProducer.getDefaultMQProducerImpl().start(false);

                //启动成功
                log.info("the client factory [{}] start OK", this.clientId);
                this.serviceState = ServiceState.RUNNING;

                break;
            case RUNNING:
                break;
            case SHUTDOWN_ALREADY:
                break;
            case START_FAILED:
                throw new MQClientException("The Factory object[" + this.getClientId() + "] has been created before, and failed.", null);
            default:
                break;
        }
    }
}
 
开发者ID:medusar,项目名称:rocketmq-commet,代码行数:66,代码来源:MQClientInstance.java


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