tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mufaddal Khumri <mufad...@wmotion.com>
Subject Re: HOW CAN I USE THREADS IN TOMCAT
Date Mon, 03 Nov 2003 03:28:12 GMT
Hi,

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;

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 ?

  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 ?

Thanks.

On Monday, November 3, 2003, at 08:45  PM, IvanLatysh wrote:

> Hello, Prince!
> You wrote to "Tomcat Users List" <tomcat-user@jakarta.apache.org> on 
> Sat, 1 Nov 2003 13:21:42 +0530:
>
>  P> Hi,
>  P>  I need to send a mail automatically at 10 minutes interval. how 
> can
>  P> i do this? how can i activate threads in tomcat?
>
> Tomcat is a Java application, there are no difference of using threads 
> with Tomcat or without it.
> Simply expand Thread class, and run your thread.
> But don't forget to notify and kill your thread when Tomcat is 
> shutting down.
>
> Here is a link that might help you.
> http://developer.java.sun.com/developer/codesamples/thrds.html
>
> ---
> Regards
> Ivan[a]yourmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message