Hi,

Shapira, Yoav wrote:

Hi,



servlet). These are daemon threads, and have the setDaemon(true) set


for


the thread before I kickoff the runnable class. The problem I'm
experiencing is that when the context needs to be reloaded these child
threads are not killed, but continue to run.



Why would they be killed? The JVM kills daemon threads on exit, and a Tomcat context reload is not a JVM exit.




think I can do a Singleton-type-thing since these old threads seem to


be


running under a different JVM(via ppid) after context reload.



They're not running under a different JVM, and ppid on your system is not a reliable method, as has been discussed on this list numerous times.



Better design/good ideas??



A ServletContextListener is better, as someone else said, because a
load-on-startup servlet may be restarted by the container as needed with
or without an application reload. But aside from that, your design
reliance on a JVM exit is a basic flaw and upgrading to a later Tomcat
version won't help you there.


Hmm, then is there a recommended way for managing child threads that are kicked off by a servlet? My servlet reads an XML file to determine what classes to create and run - but if the Servlet itself goes away and then is re-init()ed it will attempt to start those classes again. Does every Runnable child class need to implement Singleton or should I add something to the servlets destroy() method to attempt to close each child before exit? If one of the child threads were busy or locked...

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]




Thanks,
   JW

Reply via email to