tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dhana Sekar Sugunan" <dhan...@hotmail.com>
Subject tomcat hangs
Date Fri, 04 Feb 2005 09:05:37 GMT
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","mail@abc.com","mail1@abc.com","","","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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message