0
我有一個工作可以將一些數據上傳到一個ftp,並且它需要在再次啓動之前結束。因此,我已經在類中使用了DisallowConcurrentExecution屬性。現在我的問題是當工作完成後它不會等待另一個x秒,直到它開始again.For例如:Quartz.net在併發作業之間暫停
ISchedulerFactory schedFact = new StdSchedulerFactory();
IScheduler sched = schedFact.GetScheduler();
sched.Start();
IJobDetail job = JobBuilder.Create<HelloJob>()
.WithIdentity("myJob", "group1")
.Build();
ITrigger trigger = TriggerBuilder.Create()
.WithIdentity("myTrigger", "group1")
.StartNow()
.WithSimpleSchedule(x => x
.WithIntervalInSeconds(5)
.RepeatForever()
.WithMisfireHandlingInstructionNextWithRemainingCount())
.Build();
sched.ScheduleJob(job, trigger);
}}
[DisallowConcurrentExecution]
public class HelloJob : IJob
{
public void Execute(IJobExecutionContext context)
{
Console.WriteLine("start");
Thread.Sleep(5000);
Console.WriteLine("end");
}
}
這項工作開始,就什麼5秒和ends.However石英立即開始下一個工作,因爲它已經計算了5秒作爲工作開始。 那麼我該如何實現 開始工作 - 做5秒鐘 - 結束 - 等待5秒 - 再次開始 - ... 行爲與quartz.net?