zoukankan      html  css  js  c++  java
  • RocketMQ之broker读取本地文件数据

    这个load操作发生在启动broker的时候。

    所以我们直接进入DefaultMessageStore的load()方法:

       /**
         * 加载数据
         *
         * @throws IOException
         */
        public boolean load() {
            boolean result = true;
    
            try {
                boolean lastExitOK = !this.isTempFileExist();
                log.info("last shutdown {}", (lastExitOK ? "normally" : "abnormally"));
    
                // load 定时进度
                // 这个步骤要放置到最前面,从CommitLog里Recover定时消息需要依赖加载的定时级别参数
                // slave依赖scheduleMessageService做定时消息的恢复
                if (null != scheduleMessageService) {
                    result = result && this.scheduleMessageService.load();
                }
    
                // load Commit Log
                result = result && this.commitLog.load();
    
                // load Consume Queue
                result = result && this.loadConsumeQueue();
    
                if (result) {
                    this.storeCheckpoint =
                            new StoreCheckpoint(StorePathConfigHelper.getStoreCheckpoint(this.messageStoreConfig.getStorePathRootDir()));
    
                    this.indexService.load(lastExitOK);
    
                    // 尝试恢复数据
                    this.recover(lastExitOK);
    
                    log.info("load over, and the max phy offset = {}", this.getMaxPhyOffset());
                }
            } catch (Exception e) {
                log.error("load exception", e);
                result = false;
            }
    
            if (!result) {
                this.allocateMapedFileService.shutdown();
            }
    
            return result;
        }

    新开了一篇来写:http://www.cnblogs.com/guazi/p/6836112.html

  • 相关阅读:
    按不同国家语言进行字符串排序
    ASP.net的客户端脚本
    MSN photo upload tool
    Cool SMIL
    asp.net 2.0 中无刷新机制
    EF Code First 学习笔记:约定配置
    EF Code First学习笔记 初识Code First
    Silverlight、XAML实现滚动文字
    使用Nlog记录日志到数据库
    WCF:如何将net.tcp协议寄宿到IIS
  • 原文地址:https://www.cnblogs.com/guazi/p/6675541.html
Copyright © 2011-2022 走看看