简体   繁体   中英

Tomcat 7 : Filtering lifecycle events

I have defined a LifecycleListener class and added it to the <host> configuration inside the server.xml as I am interested in few of the lifecycle events of the Tomcat server [and not the contexts]: before_Start,start,before_stop.

 > <Host name="localhost" unpackWARs="false" autoDeploy="false" > deployOnStartup="false" deployXML="false"> . > <Listener className="com.sample.ServerLifecycleListener" /> > > </Host> 

What I observe is, there are lot of events :periodic, etc for which my listener is getting invoked.

Is there a way to configure the LifecycleListener with only the list of events that I am interested in?

No, there is no way to configure that. The LifeCycleListener interface is very basic and does not accept any configuration, its entire implementation is provided by you. You can however easily filter out the unwanted messagetypes within your listener. These are the types you may receive:

Tomcat 7 lifecycle events

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM