set the thread to be a daemon thread, that should make the vm exit

Filip
----- Original Message -----
From: "Shapira, Yoav" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Friday, May 07, 2004 1:30 PM
Subject: RE: unstoppable thread



Hi,

>I have a web application which, when called, starts running it's own
>thread in a new JVM, therefore Tomcat doesn't kill it when the server
>shuts down... is there any way to capture the thread again to kill it
>automatically?

Do you start the thread?  If so, keep a handle on it, and call
interrupt() in a contextDestroyed method of a ServletContextListener.
Hopefully the thread is written to gracefully and correctly handle
interrupt().

Otherwise, you're a bit SOL.  You can stick a System.exit call at the
end of the contextDestroyed method.  That'll ensure server exit ;)  If
there are other webapps on the same server instance, though, well... ;)

Yoav



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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to