Reputation: 1
We need to schedule 5-10 jobs which will run continuously to fetch data from database (large volumes and process). All these jobs are expected to run continuously for a minimum period of 5 days. We are planning to use Spring quartz, Please provide all of your valuable suggestions on this? Whether is it a good idea to do so and how to achieve this?
Upvotes: 0
Views: 1495
Reputation: 5059
Yes, Quartz is a good idea if you need to schedule regular async activity (like what you describe) on a regular basis. It doesn't matter that it takes 5 days (or 5 minutes or 5 years) to run, however you should be careful about specifying the recurrance (i.e., the cron expression) so that you're not starting the next round of each job before the previous one has finished. (Quartz can help you here with options like that described in 22.2.2 of http://static.springsource.org/spring/docs/1.2.9/reference/scheduling.html)
On the other hand, if you don't need regular async activity (i.e., just one time or unschedule-able), then it's probably simpler to just define a runnable (even better, use the latest JDK concurrent helpers for less risky implementations).
Upvotes: 2