title: In Quartz.NET is there a way to set a property that will only allow one instance of a Job to run?
body: <p>I have a service that will run every X minutes. If that job takes longer than X minutes for some unforeseen reason I want to make sure that the trigger doesn't kick off a second instance of this job. </p>
  
  <p><strong>Sample Scenario</strong></p>
  
  <ul>
  <li>I have Job X, picks up files and is triggered by Quartz every 1 minute. </li>
  <li>Job X can typically process 100 files in 1 minute, anything over 100 files will take longer than 1 minute.</li>
  <li>Since the last run time, 150 files happen to be out there so Job X kicks off and begins processing. When 1 minute is reached 100 files were processed, 50 files remain, and Job X continues to run.</li>
  <li>However a second instance of Job X is kicked off because the trigger fires every 1 minute.</li>
  <li>I now have 2 instances of Job X picking up the same 50 files.</li>
  </ul>
  
  <p>Is there a way to wire up Quartz.NET to only allow 1 instance of a Job? I'm OK with the second trigger waiting for the first to complete or I'm also OK with an option for it to skip the second trigger since it will be triggered again in a minute.</p>
  
  <p><br /><br />
  I took a look at the Java version of Quartz API and found a property '<a href="http://www.quartz-scheduler.org/docs/api/2.0.0/org/quartz/DisallowConcurrentExecution.html" rel="noreferrer">DisallowConcurrentExecution</a>' but didn't find one similar in the .NET version.</p>
  
  <p><strong>My Code for the Quartz.NET Implementation</strong></p>
  
  <pre>
  public IScheduler Scheduler { get; set; }<br />public IJobListener AutofacJobListener { get; set; }<br /><br />public void Start()<br />{<br />    var trigger = TriggerUtils.MakeMinutelyTrigger(1);<br />    trigger.Name = @"Document Import Trigger";<br />    <br />    Scheduler.ScheduleJob(new JobDetail("Document Import", null, typeof(DocumentImportJob)), trigger);<br />    Scheduler.AddGlobalJobListener(AutofacJobListener);<br />    Scheduler.Start();<br />}
  </pre>