I'm trying to run a scheduled task every 10 minutes using the spring scheduler, but when I deploy to tomcat it seems to run at random times. In experimenting I've tried setting the timing to as low as 1 second, but my job seems to run every 8 or 9 seconds. I tried bumping it up to 10 seconds, but it seems to want to run every 30 or seconds. I've tried tomcat 5.5.29 and tomcat6 both are having the same issue. Here's my context.xml:
My worker class:Code:<context:component-scan base-package="my.worker.package" /> <task:scheduled-tasks scheduler="myScheduler"> <task:scheduled ref="worker" method="doWork" fixed-rate="1000" /> </task:scheduled-tasks/> <task:scheduler id="myScheduler" pool-size="10" />
The odd part is it looks like it runs with the correct timing while deploying on startup, but once tomcat gets started then the timing becomes less predictable.Code:@Service public class Worker { public void doWork() { System.out.println(new Date()); } }
Thanks for any help or advice.
Dave
I'm using the spring 3.0.3 release


Reply With Quote