本文整理汇总了C#中IScheduler.UnscheduleJob方法的典型用法代码示例。如果您正苦于以下问题:C# IScheduler.UnscheduleJob方法的具体用法?C# IScheduler.UnscheduleJob怎么用?C# IScheduler.UnscheduleJob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScheduler
的用法示例。
在下文中一共展示了IScheduler.UnscheduleJob方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CleanUp
private static void CleanUp(IScheduler inScheduler)
{
// unschedule jobs
IList<string> groups = inScheduler.GetTriggerGroupNames();
foreach (string group in groups)
{
Collection.ISet<TriggerKey> keys = inScheduler.GetTriggerKeys(GroupMatcher<TriggerKey>.GroupEquals(group));
foreach (TriggerKey key in keys)
{
inScheduler.UnscheduleJob(key);
}
}
// delete jobs
groups = inScheduler.GetJobGroupNames();
foreach (string group in groups)
{
Collection.ISet<JobKey> jobNames = inScheduler.GetJobKeys(GroupMatcher<JobKey>.GroupEquals(group));
foreach (JobKey jobKey in jobNames)
{
inScheduler.DeleteJob(jobKey);
}
}
inScheduler.DeleteCalendar("annualCalendar");
inScheduler.DeleteCalendar("baseCalendar");
inScheduler.DeleteCalendar("cronCalendar");
inScheduler.DeleteCalendar("dailyCalendar");
inScheduler.DeleteCalendar("holidayCalendar");
inScheduler.DeleteCalendar("monthlyCalendar");
inScheduler.DeleteCalendar("weeklyCalendar");
}
示例2: Test
//.........这里部分代码省略.........
job = new JobDetailImpl("job_" + count, schedId, typeof(SimpleRecoveryJob));
// ask scheduler to re-Execute this job if it was in progress when
// the scheduler went down...
job.RequestsRecovery = (true);
IOperableTrigger ct = new CronTriggerImpl("cron_trig_" + count, schedId, "0/10 * * * * ?");
ct.JobDataMap.Add("key", "value");
ct.StartTimeUtc = DateTime.Now.AddMilliseconds(1000);
scheduler.ScheduleJob(job, ct);
count++;
job = new JobDetailImpl("job_" + count, schedId, typeof(SimpleRecoveryJob));
// ask scheduler to re-Execute this job if it was in progress when
// the scheduler went down...
job.RequestsRecovery = (true);
DailyTimeIntervalTriggerImpl nt = new DailyTimeIntervalTriggerImpl("nth_trig_" + count, schedId, new TimeOfDay(1, 1, 1), new TimeOfDay(23, 30, 0), IntervalUnit.Hour, 1);
nt.StartTimeUtc = DateTime.Now.Date.AddMilliseconds(1000);
scheduler.ScheduleJob(job, nt);
DailyTimeIntervalTriggerImpl nt2 = new DailyTimeIntervalTriggerImpl();
nt2.Key = new TriggerKey("nth_trig2_" + count, schedId);
nt2.StartTimeUtc = DateTime.Now.Date.AddMilliseconds(1000);
nt2.JobKey = job.Key;
scheduler.ScheduleJob(nt2);
// GitHub issue #92
scheduler.GetTrigger(nt2.Key);
// GitHub issue #98
nt2.StartTimeOfDay = new TimeOfDay(1, 2, 3);
nt2.EndTimeOfDay = new TimeOfDay(2, 3, 4);
scheduler.UnscheduleJob(nt2.Key);
scheduler.ScheduleJob(nt2);
var triggerFromDb = (IDailyTimeIntervalTrigger) scheduler.GetTrigger(nt2.Key);
Assert.That(triggerFromDb.StartTimeOfDay.Hour, Is.EqualTo(1));
Assert.That(triggerFromDb.StartTimeOfDay.Minute, Is.EqualTo(2));
Assert.That(triggerFromDb.StartTimeOfDay.Second, Is.EqualTo(3));
Assert.That(triggerFromDb.EndTimeOfDay.Hour, Is.EqualTo(2));
Assert.That(triggerFromDb.EndTimeOfDay.Minute, Is.EqualTo(3));
Assert.That(triggerFromDb.EndTimeOfDay.Second, Is.EqualTo(4));
job.RequestsRecovery = (true);
CalendarIntervalTriggerImpl intervalTrigger = new CalendarIntervalTriggerImpl(
"calint_trig_" + count,
schedId,
DateTime.UtcNow.AddMilliseconds(300),
DateTime.UtcNow.AddMinutes(1),
IntervalUnit.Second,
8);
intervalTrigger.JobKey = job.Key;
scheduler.ScheduleJob(intervalTrigger);
// bulk operations
var info = new Dictionary<IJobDetail, Collection.ISet<ITrigger>>();
IJobDetail detail = new JobDetailImpl("job_" + count, schedId, typeof(SimpleRecoveryJob));
ITrigger simple = new SimpleTriggerImpl("trig_" + count, schedId, 20, TimeSpan.FromMilliseconds(4500));
var triggers = new Collection.HashSet<ITrigger>();
triggers.Add(simple);
info[detail] = triggers;
scheduler.ScheduleJobs(info, true);
示例3: UnscheduleJob
public bool UnscheduleJob(IScheduler qScheduler, string sJobName, string sJobGroup, string sCronExpression, int iPriority)
{
var jobKey = new JobKey(sJobName, sJobGroup);
if (qScheduler.CheckExists(jobKey))
{
return qScheduler.UnscheduleJob(new TriggerKey(sJobName, sJobGroup));
}
return false;
}