Hi,

The problem is that stop / suspend are deprecated. The destroy() method has yet not been implemented ? What does one do then?

I have a solution -

Keep a reference to the instances of the threads spawned in a hashtable. In contextDestroy make all these references null . Will this solution work ?

Thanks.

On Monday, November 3, 2003, at 09:27 PM, Shapira, Yoav wrote:


Howdy,


I have an instance of MyMailScheduler - mmsched in a ContextListener
class for my webapp. mmsched spawns threads to do some work regarding
sending emails. In my contextDestroy method I do : mmsched = null;

mmsched should have a close()/stop()/shutdown() method which stops its threads. You call this method, and then set mmsched to null.

I was under the impression that if tomcat was shutdown or the webapp
was stopped my threads would be automatically killed since mmsched
would be garbage collected. Am I understanding this right or do I need
to do something else ?

The JVM can't stop non-daemon threads. Either make mmsched spawn daemon
threads, or make the mmsched stop() method interrupt and stop all its
threads.


 My webapp does two mail related tasks for two different sets of data.
Both tasks are identical and therefore I spawn two threads. The two
threads do not share any data structures. Also do I need to make the
run() method synchronized ?

You don't need to make the run() method synchronized.


Yoav Shapira



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