提交 26841dfc 编写于 作者: wu-sheng's avatar wu-sheng

Fix startup issue.

上级 c16d7b8b
......@@ -21,6 +21,7 @@ public enum ServiceManager {
public void boot() {
bootedServices = loadAllServices();
startup();
}
private Map<Class, BootService> loadAllServices() {
......@@ -28,14 +29,19 @@ public enum ServiceManager {
Iterator<BootService> serviceIterator = load().iterator();
while (serviceIterator.hasNext()) {
BootService bootService = serviceIterator.next();
bootedServices.put(bootService.getClass(), bootService);
}
return bootedServices;
}
private void startup() {
for (BootService service : bootedServices.values()) {
try {
bootService.bootUp();
bootedServices.put(bootService.getClass(), bootService);
service.bootUp();
} catch (Throwable e) {
logger.error(e, "ServiceManager try to start [{}] fail.", bootService.getClass().getName());
logger.error(e, "ServiceManager try to start [{}] fail.", service.getClass().getName());
}
}
return bootedServices;
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册