1

I am using Tomcat with the Spring framework. I want to have a class called by the server every 30 minutes. Is there a good way to do this in Servlet, Spring, or Struts?

andronikus
  • 3,893
  • 1
  • 23
  • 44
Saran
  • 129
  • 4
  • 14
  • 2
    This solution is probably your best bet. http://stackoverflow.com/questions/2039349/is-it-possible-to-run-a-cron-job-in-a-web-application – CamelSlack Oct 13 '11 at 18:30
  • 4
    You might want to accept some answers to your previous questions too. – andronikus Oct 13 '11 at 18:35
  • 1
    possible duplicate of [Background timer task in JSP/Servlet web application](http://stackoverflow.com/questions/5357033/background-timer-task-in-jsp-servlet-web-application) – Perception Oct 13 '11 at 18:36

2 Answers2

-2

You could create a new Thread on container startup that sleeps for 30 minutes and then performs your action. See here for information about context listeners.

spork
  • 1,022
  • 9
  • 15