知识库--Lifecycle (44)
来源:互联网 发布:明略数据工资待遇 编辑:程序博客网 时间:2024/05/29 21:32
Lifecycle
Catalina consists of many components. When Catalina is started, these components need to be started as well. When Catalina is stopped, these components must also be given a chance to do a clean-up. For example, when the container is stopped, it must invoke the destroy method of all loaded servlets and the session manager must save the session objects to secondary storage. A consistent mechanism for starting and stopping components is achieved by implementing the org.apache.catalina.Lifecycle interface.
A component implementing the Lifecycle interface can also trigger one or many of the following events: BEFORE_START_EVENT, START_EVENT, AFTER_START_EVENT,
BEFORE_STOP_EVENT, STOP_EVENT, and AFTER_STOP_EVENT. The first three events are normally fired when the component is started and the last three when the component is stopped. An event is represented by the org.apache.catalina.LifecycleEvent class. And , of course, if a Catalina component can trigger events, there must be event listeners that you can write to response to those events. A listener is represented by the org.apache.catalina.LifecycleListener interface.
Three types Lifecycle, LifecycleEvent , and LifecycleListener. In addition, it will also explain a utility class called LifecycleSupport that provides an easy way for a component to fire lifecycle events and deal with lifecycle listeners.
The design of Catalina allows a component to contain other components. For example, a container can contain components such as a loader, a manager, etc. A parent component is responsible for starting and stopping its child components. The design of Catalina is such that all components but one are put “in custody” of a parent component so that a bootstrap class needs only single component. This single start/stop mechanism is made possible through the Lifecycle interface.
public interface Lifecylcle{ public static final String START_EVENT = "start"; public static final String BEFORE_START_EVENT = "before_start"; public static final String AFTER_START_EVENT = "after_start"; public static final String STOP_EVENT = "stop"; public static final String BEFORE_STOP_EVENT = "before_stop"; public static final String AFTER_STOP_EVENT = "after_stop"; public void addLifecycleListener(LifecycleListener listener); public LifecycleListener[] findLifecycleListener(); public void removeLifecycleListener(LifecycleListener listener); public void start() throws LifecycleException; public void stop() throws LifecycleException;}
- 知识库--Lifecycle (44)
- 知识库--lifecycle interface (46)
- 知识库--StandardService + Lifecycle(start/stop)+initialize(72)
- lifecycle
- LifeCycle
- Lifecycle
- 知识库--SimpleLoader (46)
- 知识库--Logger (46)
- 知识库--WebappLoader(47)
- 知识库--WebappClassLoader(47)
- 知识库--Session(47)
- 知识库--Sessions(48)
- 知识库--StandardSession (49)
- 知识库--PersistentManagerBase(50)
- 知识库--Realm(51)
- 知识库--Authenticator(51)
- 知识库--StandardWrapperFacade(54)
- 知识库--StandardContext(57)
- 伟东山视频自学笔记——S3C2440外部中断详解
- Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
- linux下删除文件每行开头的空格
- PAT_乙级 1040 有几个PAT
- 浮动IP(FLOAT IP)
- 知识库--Lifecycle (44)
- Fiddler抓包教程
- 伟东山视频自学笔记——uboot-的start.S详细注解及分析
- 定义 多个条件判断 组合 为一个判断条件 的方法
- Forge Acision即时通讯学习
- 第十五周项目四 验证算法——直接插入排序
- Qt开发之HTTP
- 数组中只出现一次的数字
- 伟东山视频自学笔记——uboot命令分析+实现_________精华————————