本文整理汇总了C#中IScheduler.GetCalendar方法的典型用法代码示例。如果您正苦于以下问题:C# IScheduler.GetCalendar方法的具体用法?C# IScheduler.GetCalendar怎么用?C# IScheduler.GetCalendar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScheduler
的用法示例。
在下文中一共展示了IScheduler.GetCalendar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test
public void Test(IScheduler scheduler, bool clearJobs, bool scheduleJobs)
{
try
{
if (clearJobs)
{
scheduler.Clear();
}
if (scheduleJobs)
{
ICalendar cronCalendar = new CronCalendar("0/5 * * * * ?");
ICalendar holidayCalendar = new HolidayCalendar();
// QRTZNET-86
ITrigger t = scheduler.GetTrigger(new TriggerKey("NonExistingTrigger", "NonExistingGroup"));
Assert.IsNull(t);
AnnualCalendar cal = new AnnualCalendar();
scheduler.AddCalendar("annualCalendar", cal, false, true);
IOperableTrigger calendarsTrigger = new SimpleTriggerImpl("calendarsTrigger", "test", 20, TimeSpan.FromMilliseconds(5));
calendarsTrigger.CalendarName = "annualCalendar";
JobDetailImpl jd = new JobDetailImpl("testJob", "test", typeof(NoOpJob));
scheduler.ScheduleJob(jd, calendarsTrigger);
// QRTZNET-93
scheduler.AddCalendar("annualCalendar", cal, true, true);
scheduler.AddCalendar("baseCalendar", new BaseCalendar(), false, true);
scheduler.AddCalendar("cronCalendar", cronCalendar, false, true);
scheduler.AddCalendar("dailyCalendar", new DailyCalendar(DateTime.Now.Date, DateTime.Now.AddMinutes(1)), false, true);
scheduler.AddCalendar("holidayCalendar", holidayCalendar, false, true);
scheduler.AddCalendar("monthlyCalendar", new MonthlyCalendar(), false, true);
scheduler.AddCalendar("weeklyCalendar", new WeeklyCalendar(), false, true);
scheduler.AddCalendar("cronCalendar", cronCalendar, true, true);
scheduler.AddCalendar("holidayCalendar", holidayCalendar, true, true);
Assert.IsNotNull(scheduler.GetCalendar("annualCalendar"));
JobDetailImpl lonelyJob = new JobDetailImpl("lonelyJob", "lonelyGroup", typeof(SimpleRecoveryJob));
lonelyJob.Durable = true;
lonelyJob.RequestsRecovery = true;
scheduler.AddJob(lonelyJob, false);
scheduler.AddJob(lonelyJob, true);
string schedId = scheduler.SchedulerInstanceId;
int count = 1;
JobDetailImpl 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 trigger = new SimpleTriggerImpl("trig_" + count, schedId, 20, TimeSpan.FromSeconds(5));
trigger.JobDataMap.Add("key", "value");
trigger.EndTimeUtc = DateTime.UtcNow.AddYears(10);
trigger.StartTimeUtc = DateTime.Now.AddMilliseconds(1000L);
scheduler.ScheduleJob(job, trigger);
// check that trigger was stored
ITrigger persisted = scheduler.GetTrigger(new TriggerKey("trig_" + count, schedId));
Assert.IsNotNull(persisted);
Assert.IsTrue(persisted is SimpleTriggerImpl);
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);
trigger = new SimpleTriggerImpl("trig_" + count, schedId, 20, TimeSpan.FromSeconds(5));
trigger.StartTimeUtc = (DateTime.Now.AddMilliseconds(2000L));
scheduler.ScheduleJob(job, trigger);
count++;
job = new JobDetailImpl("job_" + count, schedId, typeof(SimpleRecoveryStatefulJob));
// ask scheduler to re-Execute this job if it was in progress when
// the scheduler went down...
job.RequestsRecovery = (true);
trigger = new SimpleTriggerImpl("trig_" + count, schedId, 20, TimeSpan.FromSeconds(3));
trigger.StartTimeUtc = (DateTime.Now.AddMilliseconds(1000L));
scheduler.ScheduleJob(job, trigger);
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);
trigger = new SimpleTriggerImpl("trig_" + count, schedId, 20, TimeSpan.FromSeconds(4));
trigger.StartTimeUtc = (DateTime.Now.AddMilliseconds(1000L));
scheduler.ScheduleJob(job, trigger);
count++;
//.........这里部分代码省略.........