What is exactly mean by 'DisallowConcurrentExecution' in Quartz.net

送分小仙女□ 提交于 2019-12-23 07:38:47

问题


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.?


回答1:


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.



来源:https://stackoverflow.com/questions/23390698/what-is-exactly-mean-by-disallowconcurrentexecution-in-quartz-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!