Quartz.net中的'DisallowConcurrentExecution'到底是什么意思 [英] What is exactly mean by 'DisallowConcurrentExecution' in Quartz.net

查看:744
本文介绍了Quartz.net中的'DisallowConcurrentExecution'到底是什么意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有以下定义的Quartz.net作业.

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,

        }
   }

因为我已经用DisallowConcurrentExecution属性装饰了工作.
我对这个属性的了解是,我们无法同时运行同一作业的多个实例.这里的多个实例是什么意思??
AddItemsJob的两个具有不同密钥的作业是否称为相同实例或不同实例??
具有不同密钥的两个作业可以同时执行吗??

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

推荐答案

作业 instance 是具有唯一密钥的作业.因此,具有 type 类型的工作的AddItemsJob可以具有两个实例,这些实例的键为AddItemsJob.Admin和AddItemsJobs.Legacy. 并发保护是针对每个作业密钥而来的-如果上述两个作业是使用重叠触发器定义的,则它们可以同时运行. 即使有多个触发器具有与之关联的时间表,在单个键后定义单个作业也不会同时运行.

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.

这篇关于Quartz.net中的'DisallowConcurrentExecution'到底是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆