java基础-tomcat启动过程
Bootstrap,启动main方法public static void main(String args[]) {
private void load(String[] arguments){
会启动Catalina中的
public void load() {
...
// 初始化 并加载 解析server.xml文件
initDirs();
initNaming();
Digester digester = createStartDigester();
digester.push(this);
digester.parse(inputSource);
getServer().init(); //会执行StandardServer中的protected void initInternal()
}
public void start(){
会启动Catalina中的
public void start() {
...
getServer().start();// 会执行StandardServer中的protected void startInternal()
}
StandardServer 包含StandstardService
synchronized (services) {
for (int i = 0; i < services.length; i++) {
services.start();
}
}
StandstardService 包含StandstardEngine
if (container != null) {
synchronized (container) {
container.start();
}
}
StandstardEngine,包含ContainerBase中的
protected synchronized void startInternal() throws LifecycleException {
protected void threadStart() {
这时候会启动一个后台线程
接着会启动Connector中的
protected void startInternal() throws LifecycleException {
接着会启动AbstractProtocol中的
public void start() throws Exception {
接着会启动AbstractEndpoint中的
public final void start() throws Exception {
接着会启动JIoEndpoint中的
public void startInternal() throws Exception {
这时候会启动两个线程,一个监听请求的,一个异步化操作的。
接着会启动MapperListener中的
public void startInternal() throws LifecycleException {
至此服务全部启动完毕。
2013-9-6 10:23:06 org.apache.catalina.startup.Catalina start
信息: Server startup in 200533 ms
整个过程有点像剥洋葱,一层一层嵌套启动,非常经典的一个过程。
页:
[1]