3
votes

I am looking into Quartz.NET for scheduling tasks. One of the requirements being that I want to be able to schedule multiple jobs to the same trigger (basically sharing a trigger). However, Quartz.NET doesn't allow this. I also noticed in Windows Task Scheduler, you also cannot share triggers.

Having multiple jobs mapped to the same trigger seems like a common requirement. My question is, why is this not allowed? is there a reason NOT to to schedule multiple jobs to the same trigger?

2

2 Answers

4
votes

In Quartz, you can assign multiple triggers to the same job, because some schedules cannot be represented by a single trigger. Probably Quartz doesn't support the reverse connection (multiple jobs per trigger) because:

  1. It would add complexity to the existing code which already allows multiple triggers per job.

  2. Multiple jobs per trigger can easily be accomplished by creating a composite job, whose purpose would be to run other jobs.

2
votes

I never thought of it and it looks like an appealing idea. But I think, it's just a guess, that the reason why it can't be done has to do with manageability and resources.

  • Manageability: The job (or task) is the main entity to manage in a scheduler. It can have multiple triggers. Those triggers should (preferably) not compete one another. Suppose you could share triggers among jobs and you want to change a trigger. It would be hard to tell whether your changes interfere with any other trigger on any other job that is affected by it. I don't know the designers of Quartz, but that may be a reason for disallowing shared triggers. It would introduce a lateral management layer.

  • Resources: Sharing triggers would promote the execution of jobs at exactly the same moment. Quartz's thread pool is practically unlimited, but machine resources are not, obviously. When different triggers are fired at the same moment you can do some tuning by setting their priorities. However, when one trigger fires multiple times this possibility is eliminated (or some automated tuning should occur).