Saran
Saran

Reputation: 169

How to call a class in every 30 minutes in java web application

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?

Upvotes: 1

Views: 1235

Answers (2)

spork
spork

Reputation: 1265

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.

Upvotes: -2

Related Questions