tomcat-容器和组件

Container


* A Container is an object that can execute requests received from
* a client, and return responses based on those requests.  A Container may
* optionally support a pipeline of Valves that process the request in an
* order configured at runtime, by implementing the <b>Pipeline</b> interface
* as well.
* 
* Containers will exist at several conceptual levels within Catalina.  The
* following examples represent common cases:
* 
* Engine - Representation of the entire Catalina servlet engine,
*     most likely containing one or more subcontainers that are either Host
*     or Context implementations, or other custom groups.
* Host - Representation of a virtual host containing a number
*     of Contexts.
* Context - Representation of a single ServletContext, which will
*     typically contain one or more Wrappers for the supported servlets.
* Wrapper - Representation of an individual servlet definition
*     (which may support multiple servlet instances if the servlet itself
*     implements SingleThreadModel).
* 
* A given deployment of Catalina need not include Containers at all of the
* levels described above.  For example, an administration application
* embedded within a network device (such as a router) might only contain
* a single Context and a few Wrappers, or even a single Wrapper if the
* application is relatively small.  Therefore, Container implementations
* need to be designed so that they will operate correctly in the absence
* of parent Containers in a given deployment.


components

* A Container may also be associated with a number of support components
* that provide functionality which might be shared (by attaching it to a
* parent Container) or individually customized.  The following support
* components are currently recognized:
* 
* Loader - Class loader to use for integrating new Java classes
*     for this Container into the JVM in which Catalina is running.
* Logger - Implementation of the <code>log()</code> method
*     signatures of the <code>ServletContext</code> interface.
* Manager - Manager for the pool of Sessions associated with
*     this Container.
* Realm - Read-only interface to a security domain, for
*     authenticating user identities and their corresponding roles.
* Resources - JNDI directory context enabling access to static
*     resources, enabling custom linkages to existing server components when
*     Catalina is embedded in a larger server.
* 

组件的生命周期:

 Init => start => stop => destroy

*            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()                             |
* --->------------------------------>------------------------------




组件生命周期事件

/**
 * The LifecycleEvent type for the "component after init" event.
 */
public static final String BEFORE_INIT_EVENT = "before_init";


/**
 * The LifecycleEvent type for the "component after init" event.
 */
public static final String AFTER_INIT_EVENT = "after_init";


/**
 * The LifecycleEvent type for the "component start" event.
 */
public static final String START_EVENT = "start";


/**
 * The LifecycleEvent type for the "component before start" event.
 */
public static final String BEFORE_START_EVENT = "before_start";


/**
 * The LifecycleEvent type for the "component after start" event.
 */
public static final String AFTER_START_EVENT = "after_start";


/**
 * The LifecycleEvent type for the "component stop" event.
 */
public static final String STOP_EVENT = "stop";


/**
 * The LifecycleEvent type for the "component before stop" event.
 */
public static final String BEFORE_STOP_EVENT = "before_stop";


/**
 * The LifecycleEvent type for the "component after stop" event.
 */
public static final String AFTER_STOP_EVENT = "after_stop";


/**
 * The LifecycleEvent type for the "component after destroy" event.
 */
public static final String AFTER_DESTROY_EVENT = "after_destroy";


/**
 * The LifecycleEvent type for the "component before destroy" event.
 */
public static final String BEFORE_DESTROY_EVENT = "before_destroy";


/**
 * The LifecycleEvent type for the "periodic" event.
 */
public static final String PERIODIC_EVENT = "periodic";


/**
 * The LifecycleEvent type for the "configure_start" event. Used by those
 * components that use a separate component to perform configuration and
 * need to signal when configuration should be performed - usually after
 * {@link #BEFORE_START_EVENT} and before {@link #START_EVENT}.
 */
public static final String CONFIGURE_START_EVENT = "configure_start";


/**
 * The LifecycleEvent type for the "configure_stop" event. Used by those
 * components that use a separate component to perform configuration and
 * need to signal when de-configuration should be performed - usually after
 * {@link #STOP_EVENT} and before {@link #AFTER_STOP_EVENT}.
 */
public static final String CONFIGURE_STOP_EVENT = "configure_stop";


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值