Jul 2nd, 2012, 05:47 AM
CronTrigger endTime can not be specified through CronTriggerFactoryBean
There has been a requirement on my project to specify endTime for crontrigger. I'm using spring 3.1 and Quartz 2.0.2.
Although Quartz's native class CrontriggerImpl supports endTime property( which specify what is the last time the trigger should fire). But Spring's CronTriggerFactoryBean does not have any method though which I can specify the end time for a particular trigger. Could anybody suggest if there is any way, by which I can set it?
Jul 2nd, 2012, 10:09 AM
I believe you can use the same (not so elegant) workaround I suggested here.
Jul 3rd, 2012, 03:20 AM
Thanks for your reply. But It is quite difficult to write one generic method to calculate repeat interval for cron trigger.
For one time job if I set the job durability as false and when the associated trigger finished its job, the job and trigger automatically get deleted from quartz database.(I'm using DataBase JOB store).
But problem starts with cron trigger.I have though of one manual workaround(dirty though). I am scheduling one job which would run on that end time. And that job would actually delete rows from respective database tables corresponding to the actual job and trigger.
Actually in my project, user give input about the end time of a trigger. So, If I can set the end Time property of cron trigger through spring,my job is done.
I have saw your post and the jira issue you raised for repeatInterval. It would be nice to have endTime property on crontriggerfactorybean.I do not know how to raise a jira issue. If you please can raise it it would be great for other developers too who would like to use this feature.
Tags for this Thread