tomcat一点


1.TOMCAT的启动过程主要分为初始化init 和启动二步start.
2.容器主要为二大块,连接器connector与容器Container'
connector负责接受来的请求,并且创建请求与响应对象,然后交给Container去处理
3.tomcat定义了好多的组件,如下:
server service connector Container等组件,
组件对应关系:
一个server可以对应多个service组件,如源码中:
public void addService(Service service) {

service.setServer(this);

synchronized (services) {
Service results[] = new Service[services.length + 1];
System.arraycopy(services, 0, results, 0, services.length);
results[services.length] = service;
services = results;

if (initialized) {
try {
service.initialize();
} catch (LifecycleException e) {
log.error(e);
}
}

if (started && (service instanceof Lifecycle)) {
try {
((Lifecycle) service).start();
} catch (LifecycleException e) {
;
}
}

// Report this property change to interested listeners
support.firePropertyChange("service", null, service);
}

}
一个Service组件对应多个连接器:
public void addConnector(Connector connector) {

synchronized (connectors) {
connector.setContainer(this.container);
connector.setService(this);
Connector results[] = new Connector[connectors.length + 1];
System.arraycopy(connectors, 0, results, 0, connectors.length);
results[connectors.length] = connector;
connectors = results;

if (initialized) {
try {
connector.initialize();
} catch (LifecycleException e) {
log.error("Connector.initialize", e);
}
}

if (started && (connector instanceof Lifecycle)) {
try {
((Lifecycle) connector).start();
} catch (LifecycleException e) {
log.error("Connector.start", e);
}
}

// Report this property change to interested listeners
support.firePropertyChange("connector", null, connector);
}

}
Container里饮食几个组件 Engine,Host,Context,Wrapper
Host对应的是一个Server,可以供多个应用服务,而Context
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值