Hi,

I am not sure i am posting this in the correct area. Please bear and advice.

My application needs to run a thread contiuously for every 1 hr. I have made the coding in servlet as
package invservlet;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Date;
import java.util.Calendar;
import sample.Reminder;
public class SampleReminder extends HttpServlet{
Timer timer;
Date date=new Date();
Calendar calc=Calendar.getInstance();
public void init(){
timer = new Timer();
timer.schedule(new Reminder(),calc.getTime(),1*1000*60*60);
}
public void doService(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
}
public void destroy(){
timer.cancel();
super.destroy();
}
}


and the execution file is

package sample;
import java.util.TimerTask;
import java.util.Date;
import box.util.SendMail;

public class Reminder extends TimerTask{
SendMail sendMail=new SendMail();
public void run() {
taskBody();
}
public void taskBody()
{

try{
sendMail.SendMail("192.168.0.33","[EMAIL PROTECTED]","[EMAIL PROTECTED]","","","Test log mail","This is a test mail for every 1 hour"+new Date());
}catch(Exception e){System.out.println("ERROR IN Remainder");}


}
}

BUT EVERY 2 - 3 DAYS I AM GETTING MY TOMCAT HANGING. I THINK THE PROBLEM IS IN THE THREAD. PLEASE ADVICE. THANKS.

Sorry, forget to add some more points which may help for analysation.
My application will fetch more than 1000 records for single transaction.
And also some times in will be transferred (sendRedirect) to another page with nearly 20 fields of data.


Will this also create problem?

_________________________________________________________________
MSN Spaces! Your space, your time. http://www.msn.co.in/spaces Your personal haven online.



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to