0%

Pipeline和Value

Pipeline和Value

Pipeline是管道,而Value就是管道中的阀门,Request和Response对象在管道中通过各个阀门的处理和控制。

每一个容器中都包含有管道

1
protected final Pipeline pipeline = new StandardPipeline(this);

且管道中都有一个必不可少的basic value,StandardContext对应的basic value为StandardContextValve,StandardEngine对应的basic value为StandardEngineValve,StandardHost对应的basic value为StandardHostValve,StandardWrapper对应的basic value为StandardWrapperValve

value存储

value是链式存储的,通过getNext、setNext来实现链式关系

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public void addValve(Valve valve) {

// Add this Valve to the set associated with this Pipeline
if (first == null) {
first = valve;
valve.setNext(basic);
} else {
Valve current = first;
while (current != null) {
if (current.getNext() == basic) {
current.setNext(valve);
valve.setNext(basic);
break;
}
current = current.getNext();
}
}

container.fireContainerEvent(Container.ADD_VALVE_EVENT, valve);
}

欢迎关注我的其它发布渠道