Question

I'm evaluating, whether Quartz Scheduler will fit into our project needs. Didn't find a solution for one of our needs in tutorial or docs. Feature we want have is to disable a recurring job for one of its repetitions, but don't disable the others (before and after that).

Example: let say I have a Job, which has Trigger which triggers every day at 08:00:00 and 20:00:00. Now suddenly comes a requirement to disable this trigger from firing on one specific date and time, let say 3 days from now at 20:00:00. Days and times before and after that not to be influenced. How to achieve this?

pauseJob() and pauseTrigger() are obviously no help for this situation and I'm not sure how Calendar could help here. Any advice? Do I need to implement my own Trigger class?

Was it helpful?

Solution

Found a workaround that fits my needs, maybe it helps someone else: set end time of the trigger 1 second before the desired fire time I want to skip - trigger.setEndTime(endTime) and apply the changes - scheduler.rescheduleJob(trigger.getKey(), trigger) (watch out for trigger's startTime to not get some funky results). Then add another trigger with startTime 1 second after the desired fire time I want to skip, otherwise exactly the same as previous trigger. Use groups to determine they are both doing the same thing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top