tomcat 容器生命周期lifecycle
来源:互联网 发布:手机旋律合成软件 编辑:程序博客网 时间:2024/05/18 12:33
1.复习java的事件机制
java事件机制包括三个部分:事件、事件监听器、事件源。
事件:一般继承自java.util.EventObject类,封装了事件源对象及跟事件相关的信息。
事件监听器:实现java.util.EventListener接口,注册在事件源上,当事件源的属性或状态改变时,取得相应的监听器调用其内部的回调方法。
事件源:事件发生的地方,由于事件源的某项属性或状态发生了改变(比如BUTTON被单击、TEXTBOX的值发生改变等等)导致某项事件发生。
2. tomcat的lifecycle
事件定义
public final class LifecycleEvent extends EventObject {
private static final long serialVersionUID = 1L;
// ----------------------------------------------------------- Constructors
/**
* Construct a new LifecycleEvent with the specified parameters.
*
* @param lifecycle Component on which this event occurred
* @param type Event type (required)
* @param data Event data (if any)
*/
public LifecycleEvent(Lifecycle lifecycle, String type, Object data) {
super(lifecycle);
this.type = type;
this.data = data;
}
}
事件监听器
/**
* Interface defining a listener for significant events (including "component
* start" and "component stop" generated by a component that implements the
* Lifecycle interface. The listener will be fired after the associated state
* change has taken place.
*
* @author Craig R. McClanahan
* @version $Id: LifecycleListener.java 1200160 2011-11-10 05:35:13Z kkolinko $
*/
public interface LifecycleListener {
/**
* Acknowledge the occurrence of the specified event.
*
* @param event LifecycleEvent that has occurred
*/
public void lifecycleEvent(LifecycleEvent event);
}
* start()
* -----------------------------
* | |
* | init() |
* NEW ->-- INITIALIZING |
* | | | | ------------------<-----------------------
* | | |auto | | |
* | | \|/ start() \|/ \|/ auto auto stop() |
* | | INITIALIZED -->-- STARTING_PREP -->- STARTING -->- STARTED -->--- |
* | | | | | |
* | | | | | |
* | | | | | |
* | |destroy()| | | |
* | -->-----<-- auto auto | | |
* | | ---------<----- MUST_STOP ---------------------<-- | |
* | | | | |
* | \|/ ---------------------------<-------------------------------- ^
* | | | |
* | | \|/ auto auto start() |
* | | STOPPING_PREP ------>----- STOPPING ------>----- STOPPED ---->------
* | | ^ | | ^
* | | stop() | | | |
* | | -------------------------- | | |
* | | | auto | | |
* | | | MUST_DESTROY------<------- | |
* | | | | | |
* | | | |auto | |
* | | | destroy() \|/ destroy() | |
* | | FAILED ---->------ DESTROYING ---<----------------- |
* | | ^ | |
* | | destroy() | |auto |
* | -------->----------------- \|/ |
* | DESTROYED |
* | |
* | stop() |
* --->------------------------------>------------------------------
public interface Lifecycle
3. lifecycle在tomcat中的使用。
public interface Server extends Lifecycle
public interface Service extends Lifecycle
public interface Container extends Lifecycle
0 0
- tomcat 容器生命周期lifecycle
- tomcat 容器生命周期lifecycle
- Tomcat组件的生命周期Lifecycle
- Tomcat学习6.1(生命周期Lifecycle)
- tomcat生命周期的管理——生命周期统一接口Lifecycle
- Lifecycle(生命周期)
- Tomcat 8(九)解读Tomcat组件的生命周期(Lifecycle)
- Tomcat 8(九)解读Tomcat组件的生命周期(Lifecycle)
- How Tomcat works之第六章:Lifecycle生命周期
- 探索《How Tomcat Works》心得(四)生命周期 Lifecycle
- Tomcat Lifecycle
- Activity生命周期(Activity Lifecycle)
- Activity LifeCycle 生命周期
- 活动的生命周期<LifeCycle>
- spring中的lifeCycle(生命周期)
- Tomcat容器中相关对象的生命周期
- 先码后看 Tomcat是怎么启动容器的——Lifecycle篇 侵立删
- tomcat中的Lifecycle架构
- fully qualified host name就是fully qualified domain name
- Socket桥(转载)
- 发散 求1-100的和的方法
- android 辅助工具类——文件简单操作辅助类
- tomcat server容器解读
- tomcat 容器生命周期lifecycle
- Java Management extentsions(jmx)与tomcat
- 转载--tomcat整合apr
- 转载--redis密码管理
- 转载----How fast is Redis?
- 结构体的内存对齐问题
- select语句for update---转载
- BEA-141150 - An error occurred while preparing application component uri of application application with HTTP response responseC
- 深入redis内部--字典实现