Reputation: 307
I'm developing an web application which is developed in Struts 2 and I'm deploying it on Apache Tomcat server.
I want to do database cleanup on daily basis automatically.
Also I want to to call a method in java class with 10 minutes of interval. Any suggestion for this.
Upvotes: -1
Views: 93
Reputation: 340230
ScheduledExecutorService
This topic has been addressed many times already on a Stack Overflow.
Specifically look at ScheduledExecutorService
.
A background thread can run your task at regular intervals.
Upvotes: 0
Reputation: 1
You can use Quartz scheduler with Struts2 or Spring's @Scheduled
. Here's the example to use Struts 2 + Spring 3 + Quartz 1.8 Scheduler Example.
There you can modify cron expression to run every 10 min
<property name="cronExpression" value="* 0/10 * * * ?" />
Upvotes: 1