Howdy, Of course there's a way, and it has nothing to do with tomcat ;) When launching threads, keep a reference to them somewhere. That somewhere should have a close() method with closes all the threads. That close() method can be called in the somewhere finalizer or from the contextDestroyed() method of a servlet context listener. The code in the close() method should be tolerant of the threads being already closed, e.g. check isActive() before calling interrupt().
Do not launch "asynchronous" threads without keeping references to them. Yoav Shapira Millennium ChemInformatics >-----Original Message----- >From: Frank Lawlor [mailto:[EMAIL PROTECTED] >Sent: Tuesday, March 11, 2003 2:27 PM >To: Tomcat >Subject: RE: How to listen for shutdown > >Let me try to explain this better, > > > >The problem seems to be that Tomcat is shutting down the asynchronous >threads >BEFORE I can cleanly tell them to shutdown (from my servlet >contextDestroyed() method). > >I tried getting control with finalize() in the thread instance, but this >didn't seem to get called. > > > >In general there should be some way to cleanly shutdown the entire app >before Tomcat starts >destructing threads and instances. > > > >I cannot put a web.xml entry for the thread since it is not a servlet. > > > >Any suggestions? > > > > -- 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]
