启动类:Bootstrap
INSTANCE.setup(true, settings, environment);
INSTANCE.start();
启动start
private void start() {
node.start();
keepAliveThread.start();
}
Node
对每个node轮询启动,如果它是一个lifecycleComponent,则调用start方法。
for (Class extends LifecycleComponent> plugin : pluginsService.nodeServices()) {
injector.getInstance(plugin).start();
}
【elasticsearch 启动】AbstractLifeCycleComponent
@SuppressWarnings({"unchecked"})
@Override
public T start() {
if (!lifecycle.canMoveToStarted()) {
return (T) this;
}
for (LifecycleListener listener : listeners) {
listener.beforeStart();
}
doStart();
lifecycle.moveToStarted();
for (LifecycleListener listener : listeners) {
listener.afterStart();
}
return (T) this;
}protected abstract void doStart();
推荐阅读
- 杂谈|Google的佩奇等级
- elasticsearch 代码分析之modules and services
- 搜索引擎|ZenNodeDiscovery
- Aardvark_社交和日常生活信息搜索引擎。
- python|推荐一个Python的开源小工具大合集!