tomcat与java web开发技术培训教材
91元
包邮
(需用券)
去购买 >
前言
上篇文章讲到了 Wrapper 的启动。在这篇文章中初次提到了 Pipeline 和 Valve。Pipeline的实现类是 StandardPipeline,StandardPipeline 继承自 LifecycleBase,而 Valve 的实现类则比较多,这些实现类都继承自基类 ValveBase,而 ValveBase 继承自 LifecycleMBeanBase。
1. Pipeline 与 Valve 的初始化
在 ContainerBase 中有一个 Pipeline 类型的对象,其声明为:
/**
* The Pipeline object with which this Container is associated.
*/
protected final Pipeline pipeline = new StandardPipeline(this);
public StandardPipeline(Container container) {
super();
setContainer(container);
}
/**
* The Container with which this Pipeline is associated.
*/
protected Container container = null;
@Override
public void setContainer(Container container) {
this.container = container;
}
可以看出,每一个 Container 对象都包含了一个 Pipeline 对象,包括 Engine、Host、Context、Wrapper。
public StandardEngine() {
super();
pipeline.setBasic(new StandardEngineValve());
/* Set the jmvRoute using the system property jvmRoute */
try {
setJvmRoute(System.getProperty("jvmRoute"));
} catch(Exception ex) {
log.warn(sm.getString("standa