Great ideas Yoav. Thank you for your comments/input.
--JW
Shapira, Yoav wrote:
Hi,
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...
You don't need to apply the singleton pattern to each thread or
Runnable. But you do need to explicitly interrupt() and null them out
on exit. If you start a thread in a servlet's init method, its destroy
method is probably the best place for shutting it down. If you start
the thread in a ServletContextListener's contextInitialized method, its
contextDestroyed method is the best place to do it.
As long as you get the basic point, which is that JVM exit != context
reload, you'll be OK.
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]