NameNode启动源码分析 #7

Merged
zeekling merged 3 commits from namenode into master 2023-11-05 04:00:12 +00:00
Showing only changes of commit 027d9e5ef0 - Show all commits

View File

@ -153,6 +153,7 @@ private void startCommonServices(Configuration conf) throws IOException {
// 启动所有插件
for (ServicePlugin p: plugins) {
try {
// 调用插件的start接口需要插件自己实现需要实现接口ServicePlugin
p.start(this);
} catch (Throwable t) {
LOG.warn("ServicePlugin " + p + " could not be started", t);
@ -202,8 +203,7 @@ void startCommonServices(Configuration conf, HAContext haContext) throws IOExcep
// 注册快照管理器
snapshotManager.registerMXBean();
InetSocketAddress serviceAddress = NameNode.getServiceAddress(conf, true);
this.nameNodeHostName = (serviceAddress != null) ?
serviceAddress.getHostName() : "";
this.nameNodeHostName = (serviceAddress != null) ? serviceAddress.getHostName() : "";
}
```
@ -219,6 +219,7 @@ void startCommonServices(Configuration conf, HAContext haContext) throws IOExcep
```java
public void activate(Configuration conf, long blockTotal) {
pendingReconstruction.start();
// 初始化datanodeManager
datanodeManager.activate(conf);
this.redundancyThread.setName("RedundancyMonitor");
this.redundancyThread.start();
@ -231,5 +232,3 @@ public void activate(Configuration conf, long blockTotal) {
```