Hi All, I am trying to implement timer with servlet but it works only at the time of loading only while I schedule it to work after every 1 minute. What is the reason for not working later on?
My servlet code is as follows: public class TimerServlet extends GenericServlet implements SingleThreadModel { public void init(ServletConfig config) throws ServletException { Timer timer = new Timer(); System.out.println("timer started"); timer.schedule(new SessionTrack(),1000); } public void service(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException { } public String getServletInfo() { return null; } } And code for TimerTask is as follows: public class SessionTrack extends TimerTask { public void run(){ System.out.println("sending email"); Mailer mailer = new Mailer(); mailer.sendMail("profile","[EMAIL PROTECTED]"); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]