Tomcat Lifecycle

 org.apache.catalina.Lifecycle unified interface to manage the lifecycle of all life cycle components implement the Lifecycle interface.

The interface 13 defines the type String constants for the type attribute LifecycleEvent time, the role of the state distinction LifecycleEvent event component emitted,

This design approach allows multi-state sends the same type of time, and then use a property in which to distinguish between the state, without defining a variety of events.

 

 1 public interface Lifecycle {
 2 
 3     public static final String BEFORE_INIT_EVENT = "before_init";
 4     public static final String AFTER_INIT_EVENT = "after_init";
 5     public static final String START_EVENT = "start";
 6     public static final String BEFORE_START_EVENT = "before_start";
 7     public static final String AFTER_START_EVENT = "after_start";
 8     public static final String STOP_EVENT = "stop";
 9     public static final String BEFORE_STOP_EVENT = "before_stop";
10     public static final String AFTER_STOP_EVENT = "after_stop";
11     public static final String AFTER_DESTROY_EVENT = "after_destroy";
12     public static final String BEFORE_DESTROY_EVENT = "before_destroy";
13     public static final String PERIODIC_EVENT = "periodic";
14     public static final String CONFIGURE_START_EVENT = "configure_start";
15     public static final String CONFIGURE_STOP_EVENT = "configure_stop";
16 
17     public void addLifecycleListener(LifecycleListener listener);
18 
19     public LifecycleListener[] findLifecycleListeners();
20 
21 
22     public void removeLifecycleListener(LifecycleListener listener);
23 
24 
25     public void init() throws LifecycleException;
26 
27 
28     public void start() throws LifecycleException;
29 
30 
31     public void stop() throws LifecycleException;
32 
33     public void destroy() throws LifecycleException;
34 
35     public LifecycleState getState();
36 
37     public String getStateName();
38 
39     public interface SingleUse {
40     }
41 }

 

Guess you like

Origin www.cnblogs.com/xuzimian/p/10929366.html