Scheduler Quartz.net and IStatefulJob

I wonder if I understand this right.

http://quartznet.sourceforge.net/apidoc/

IStatefulJob IDs follow slightly different rules from regular IJob instances. The main difference is that the associated JobDataMap is re-saved after each execution of the job, thereby preserving the state for the next execution. Another difference is that health-saving jobs are not allowed to be executed simultaneously, which means new triggers that occur before the completion of the IJob.Execute method will be delayed.

Does this mean that all triggers will be delayed until another trigger is executed? If so, how can I make sure that only triggers do not fire until the previous trigger is executed.

Say I have a trigger A that fires every min, but for some reason it is slow and takes a minute and a half to execute. If I just use the IJob plan, the next one will shoot, and I don't want this. I want to stop trigger A from firing until it finishes.

However, at the same time, I have trigger B that fires every minute. It goes at normal speed and ends every minute on time. I do not want trigger B to be delayed due to trigger A.

From my understanding, this is what will happen if I use IStatefulJob.

+4
source share
1 answer

In short .. This is the behavior of the work. Therefore, no matter how many triggers only one instance of a given IStatefulJob can have (job name, job group dictates the instance identifier), it starts simultaneously. Thus, there can be two instances of the same type of task, but not the tasks of the same name (name, group), if the task implements IStatefulJob.

If the trigger misses the time of its fire, because of this the misfire command comes into play. A trigger that skips the next fire because the previous call is still working decides what to do based on its instruction to skip skipping (see API and tutorial).

With the regular IJob, you have no guarantee as to how many tasks will be performed at the same time if you have several triggers for it and / or misfire. IJob is just a contract interface for invoking a job. Quartz.NET 2.0 will split the combined behavior of IStatefulJob into two separate attributes: DisallowConcurrentExecution and PersistJobDataAfterExecution.

Thus, you can combine the same job type (IStatefulJobs) with two definitions (different job names) and triggers with the corresponding skip instructions.

+3
source

All Articles