I have a Quartz.net Job with the following definition.
[PersistJobDataAfterExecution]
[DisallowConcurrentExecution]
public class AdItemsJob : IJob, IInterruptableJob
{
public void Execute(IJobExecutionContext context)
{
// Job execution logic,
}
}
As I have decorated the Job with DisallowConcurrentExecution
attribute.
What I know about this attribute, we can't run multiple instances of same job at the same time. What is meant by multiple instances here.?
Does the two jobs of AddItemsJob
with different key are called same instances or different instances.?
Does two jobs with different key can execute at the same time.?
Uniquely identifies a JobDetail . Keys are composed of both a name and group, and the name must be unique within the group. If only a group is specified then the default group name will be used. Quartz provides a builder-style API for constructing scheduling-related entities via a Domain-Specific Language (DSL).
Holds state information for Job instances. JobDataMap instances are stored once when the Job is added to a scheduler. They are also re-persisted after every execution of StatefulJob instances. JobDataMap instances can also be stored with a Trigger .
A job instance is a job with unique key. So having a job of type AddItemsJob can have two instances with keys AddItemsJob.Admin and AddItemsJobs.Legacy. The concurrency protection comes per job key - the aforementioned two jobs could run simultaneously if they were defined with overlapping triggers. Having a single job defined behind single key would not run simultaneously even if there were multiple triggers having overlapping schedules associated with it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With