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]
