|
1、Send j2ee.state.starting notification
if (this.getObjectName() != null) {
Notification notification = new Notification("j2ee.state.starting",
this.getObjectName(), sequenceNumber.getAndIncrement());
broadcaster.sendNotification(notification);
}
2、实例化webappResources
有两个实现类,new FileDirContext(), new WARDirContext()
在我本机环境上是new FileDirContext()
3、webappResources 属性做一些初始设置,并生成ProxyDirContext对象。
在resourcesStart()方法中完成。
4、WebappLoader实例化
if (getLoader() == null) {
WebappLoader webappLoader = new WebappLoader(getParentClassLoader());
webappLoader.setDelegate(getDelegate());
setLoader(webappLoader);
}
5、CharsetMapper实例化
@Override
public CharsetMapper getCharsetMapper() {
// Create a mapper the first time it is requested
if (this.charsetMapper == null) {
try {
Class<?> clazz = Class.forName(charsetMapperClass);
this.charsetMapper = (CharsetMapper) clazz.newInstance();
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
this.charsetMapper = new CharsetMapper();
}
}
return (this.charsetMapper);
}
6、work directory 设置。
在我本机环境上是:work\Catalina\localhost\_
7、Validate required extensions
try {
dependencyCheck = ExtensionValidator.validateApplication
(getResources(), this);
} catch (IOException ioe) {
log.error("Error in dependencyCheck", ioe);
dependencyCheck = false;
}
8、NamingContextListener注册
9、之前的WebappLoad 启动。
if ((loader != null) && (loader instanceof Lifecycle))
((Lifecycle) loader).start();
10、resources 启动。
11、触发CONFIGURE_START_EVENT事件。
fireLifecycleEvent(Lifecycle.CONFIGURE_START_EVENT, null);
将触发ContextConfig、TldConfig等重要监听器。
12、StandardPipeline启动。
((Lifecycle) pipeline).start();
13、session管理器实例化,如无特别设置,实现类应该是new StandardManager()
14、InstanceManager实例化,并设置
15、servletContext 上下文参数设置
16、触发ServletContainerInitializer的onStartUp方法
17、监听器启动
if (!listenerStart()) {
log.error( "Error listenerStart");
ok = false;
}
18、session管理器启动。
if ((manager != null) && (manager instanceof Lifecycle)) {
((Lifecycle) getManager()).start();
}
19、启动后台线程:ContainerBackgroundProcessor
20、过滤器启动。
if (!filterStart()) {
log.error("Error filterStart");
ok = false;
}
21、启动设置load on startup元素的servlet
loadOnStartup(findChildren());
22、关闭打开的jar文件。
if (getLoader() instanceof WebappLoader) {
((WebappLoader) getLoader()).closeJARs(true);
}
23、设置成功启动状态。
|
|