public synchronized final void start(Module... modules) throws Throwable {
if (this.isStart()) {
return;
}
final AbstractAppContext appContext = this;
EventContext ec = appContext.getEnvironment().getEventContext();
/*1.Init*/
Hasor.logInfo("send init sign...");
appContext.doInitialize();
/*2.Bind*/
if (modules != null && modules.length > 0) {
for (Module module : modules) {
this.installModule(module);
}
}
ApiBinder apiBinder = appContext.newApiBinder(null);
appContext.doBind(apiBinder);
/*3.引发事件*/
ec.fireSyncEvent(EventContext.ContextEvent_Initialized, apiBinder);
appContext.doInitializeCompleted();
Hasor.logInfo("the init is completed!");
//
/*3.Start*/
Hasor.logInfo("send start sign...");
appContext.doStart();
/*2.执行Aware通知*/
List<AppContextAware> awareList = appContext.findBindingBean(AppContextAware.class);
if (awareList.isEmpty() == false) {
for (AppContextAware weak : awareList) {
weak.setAppContext(appContext);
}
}
/*3.发送启动事件*/
ec.fireSyncEvent(EventContext.ContextEvent_Started, appContext);
appContext.doStartCompleted();/*用于扩展*/
/*3.打印状态*/
this.startState = true;
Hasor.logInfo("Hasor Started now!");
}