The easiest way to realize a scheduler in Spring is to use the standard JDK timer support. The following examples describes a class which pools the database for new orders. First you have to implement your task class which includes the pooling business logic. After that you references the task class at the ScheduledTimerTask bean. The ScheduledTimerTask can be configured with a delay and a period parameter. The delay parameter regulate the first start of the timer task and the period parameter defines the iteration time.
public class PoolDBTask extends TimerTask {
public void run() {
//pooling of order db
}
}
<bean id="poolDBTask" class="org.developers.blog.spring.scheduling.PoolDBTask"/>
<bean id="scheduledTimerTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">
<!-- wait 5 seconds -->
<property name="delay" value="5000" />
<!-- run every hour -->
<property name="period" value="3600000" />
<property name="poolDBTask" ref="poolDBTask" />
</bean>
Regards
Rafael Sobek
Technorati Tags: Spring Scheduling TimerTask

Hello,
I want to ask is it possible implement with spring this scenario:
repeat{
startTask{
doJob()
sleep for 10 minutes
}
}