Quartz.NET 2.6.1: 同一个作业的多个触发器同时触发,但只需要一个触发发生

Quartz.NET 2.6.1: Multiple Triggers for same Job trigger at same time, but need only one trigger to occur

我有 工作,有多个 触发器。在某些情况下,触发器会重叠。当Quartz.NET确定需要触发重叠的Trigger时,对每个Trigger执行IJob.Execute(IJobExecutionContext context)方法。

有没有办法防止这种重叠?

提前致谢。

我还没有测试过这个,但我会给它一个机会:

[DisallowConcurrentExecution]
public class Job : IJob
{
    public void Execute(IJobExecutionContext context)
    {
        bool wasExecutedAt = WasExecutedAt(context.ScheduledFireTimeUtc);
    }

    private bool WasExecutedAt(DateTimeOffset? fireTime)
    {
         // Check and maintain the state
    }
}