Howdy, Listeners must be registered in web.xml in a <listener> tag. If your listener is registered, contextInitialized() and contextDestroyed() get called appropriately: I've tested this in every tomcat release since 4.0.1 ;)
The servlet destroy() method is a good place to cleanup items related only to that servlet. The container may load and unload (thereby calling init() and destroy()) a servlet as it sees necessary. So you shouldn't, for example, put a System.exit() call in your servlet's destroy() method. Yoav Shapira Millennium ChemInformatics >-----Original Message----- >From: Frank Lawlor [mailto:[EMAIL PROTECTED] >Sent: Friday, March 07, 2003 1:12 PM >To: 'Tomcat' >Subject: Re: How to listen for shutdown > >Thanks for the responses. > > > >I tried using ServletContextListener and added my code to the >contextDestroyed() method. > > > >It never seems to get called. > > > >My servlet is listed in web.xml under a <servlet> tag and is initialized >just fine. > > > >I also saw that there is a destroy() method which seemed like it might >be appropriate. > >When I add my code there is does get called, but it seems to have a >varying amount of time to >do its work before everything ends. Sometimes I get everything done, >sometime nothing, often >somewhere in the middle. > > > >Any suggestions on how to get either of these working? > > > >What am I missing? > > > >Is there any better documentation or examples anywhere? > > > >Thanks, > > > > -- Frank This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
