RocketMQ之broker读取本地文件数据
2024-10-21 11:35:17
这个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
最新文章
- 编辑距离——Edit Distance
- spring源码分析(一)IoC、DI
- Android Studio 使用小技巧
- UIButton 点击后变灰
- Scoket
- try-catch-finally中return的执行情况分析
- CXF之一 基础理论介绍
- 『电脑技巧』破解Win7/Win8登录密码
- (搬运工)国内顺利使用Google的另类技巧
- POJ 3678 Katu Puzzle(2 - SAT) - from lanshui_Yang
- [string]Valid Parentheses
- 支付宝支付-tp5
- 百行go代码构建p2p聊天室
- Mac下git配置
- SQL 中事务的分类
- Java入门(五):控制流程
- Piwis Tester II V18.100 with CF30 Laptop for Porsche
- 深度学习Bible学习笔记:第一章 前言
- python爬虫积累(一)--------selenium+python+PhantomJS的使用
- POJ1860-Currency Exchange (正权回路)【Bellman-Ford】