本文整理汇总了C#中IScheduler.GetMetaData方法的典型用法代码示例。如果您正苦于以下问题:C# IScheduler.GetMetaData方法的具体用法?C# IScheduler.GetMetaData怎么用?C# IScheduler.GetMetaData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScheduler
的用法示例。
在下文中一共展示了IScheduler.GetMetaData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: JsonScheduler
public JsonScheduler(IScheduler scheduler)
{
isShutdown = scheduler.IsShutdown;
inStandbyMode = scheduler.InStandbyMode;
isStarted = scheduler.IsStarted;
schedulerInstanceId = scheduler.SchedulerInstanceId;
schedulerName = scheduler.SchedulerName;
jobListeners = new List<JsonJobListener>();
foreach (var item in scheduler.ListenerManager.GetJobListeners())
{
jobListeners.Add(new JsonJobListener(item));
}
schedulerListeners = new List<JsonSchedulerListener>();
foreach (var item in scheduler.ListenerManager.GetSchedulerListeners())
{
schedulerListeners.Add(new JsonSchedulerListener(item));
}
schedulerContext = new JsonSchedulerContext(scheduler.Context);
jobStoreClustered = scheduler.GetMetaData().JobStoreClustered;
jobStoreSupportsPersistence = scheduler.GetMetaData().JobStoreSupportsPersistence;
jobStoreType = scheduler.GetMetaData().JobStoreType.FullName;
numberOfJobsExecuted = scheduler.GetMetaData().NumberOfJobsExecuted;
runningSince = scheduler.GetMetaData().RunningSince;
schedulerRemote = scheduler.GetMetaData().SchedulerRemote;
schedulerType = scheduler.GetMetaData().SchedulerType.FullName;
threadPoolSize = scheduler.GetMetaData().ThreadPoolSize;
threadPoolType = scheduler.GetMetaData().ThreadPoolType.FullName;
version = scheduler.GetMetaData().Version;
}
示例2: Main
public static void Main(string[] args)
{
// XmlConfigurator.Configure();
var properties = new NameValueCollection();
properties["quartz.scheduler.instanceName"] = "ServerScheduler";
// set thread pool info
properties["quartz.threadPool.threadCount"] = "0";
// set remoting expoter
properties["quartz.scheduler.proxy"] = "true";
properties["quartz.scheduler.proxy.address"] = "tcp://localhost:555/QuartzScheduler";
var scheduleFactory = new StdSchedulerFactory(properties);
scheduler = scheduleFactory.GetScheduler();
var md = scheduler.GetMetaData();
scheduler.Start();
IJobDetail job = JobBuilder.Create<Jobs.SimpleJob>().Build();
ITrigger jobTrigger = new SimpleTriggerImpl("TenSecondTrigger", 20, new TimeSpan(0, 0, 0, 5));
//Periodic scheduling
scheduler.ScheduleJob(job,jobTrigger);
//Trigger a job from elsewhere without a trigger for one time
var jobKey = job.Key;
var jobDataMap = job.JobDataMap;
scheduler.TriggerJob(jobKey,jobDataMap);
}
示例3: Update
public override void Update(IScheduler scheduler) {
this.Scheduler = scheduler;
this.Metadata = scheduler.GetMetaData();
this.Summary = this.Metadata.GetSummary();
this.NotifyOfPropertyChange(() => this.Metadata);
this.NotifyOfPropertyChange(() => this.Summary);
}
示例4: GetMetaData
/// <summary>
/// This method retrieves meta data from a quartz scheduler.
/// </summary>
/// <param name="qScheduler"></param>
/// <returns>string</returns>
public string GetMetaData(IScheduler qScheduler)
{
var metaData = qScheduler.GetMetaData();
return string.Format("{0}Name: '{1}'{0}InstanceID: '{2}'{0}Version: '{3}'{0}ThreadPoolSize: '{4}'{0}IsRemote: '{5}'{0}JobStoreName: '{6}'{0}SupportsPersistance: '{7}'{0}IsClustered: '{8}'{0}StandbyMode: '{9}'{0}NumberOfJobsExecuted: '{10}'{0}RunningSince: '{11}'",
Environment.NewLine,
metaData.SchedulerName,
metaData.SchedulerInstanceId,
metaData.Version,
metaData.ThreadPoolSize,
metaData.SchedulerRemote,
metaData.JobStoreType.Name,
metaData.JobStoreSupportsPersistence,
metaData.JobStoreClustered,
metaData.InStandbyMode,
metaData.NumberOfJobsExecuted,
metaData.RunningSince);
}
示例5: Test
//.........这里部分代码省略.........
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);
Assert.IsTrue(scheduler.CheckExists(detail.Key));
Assert.IsTrue(scheduler.CheckExists(simple.Key));
// QRTZNET-243
scheduler.GetJobKeys(GroupMatcher<JobKey>.GroupContains("a").DeepClone());
scheduler.GetJobKeys(GroupMatcher<JobKey>.GroupEndsWith("a").DeepClone());
scheduler.GetJobKeys(GroupMatcher<JobKey>.GroupStartsWith("a").DeepClone());
scheduler.GetJobKeys(GroupMatcher<JobKey>.GroupEquals("a").DeepClone());
scheduler.GetTriggerKeys(GroupMatcher<TriggerKey>.GroupContains("a").DeepClone());
scheduler.GetTriggerKeys(GroupMatcher<TriggerKey>.GroupEndsWith("a").DeepClone());
scheduler.GetTriggerKeys(GroupMatcher<TriggerKey>.GroupStartsWith("a").DeepClone());
scheduler.GetTriggerKeys(GroupMatcher<TriggerKey>.GroupEquals("a").DeepClone());
scheduler.Start();
Thread.Sleep(TimeSpan.FromSeconds(3));
scheduler.PauseAll();
scheduler.ResumeAll();
scheduler.PauseJob(new JobKey("job_1", schedId));
scheduler.ResumeJob(new JobKey("job_1", schedId));
scheduler.PauseJobs(GroupMatcher<JobKey>.GroupEquals(schedId));
Thread.Sleep(TimeSpan.FromSeconds(1));
scheduler.ResumeJobs(GroupMatcher<JobKey>.GroupEquals(schedId));
scheduler.PauseTrigger(new TriggerKey("trig_2", schedId));
scheduler.ResumeTrigger(new TriggerKey("trig_2", schedId));
scheduler.PauseTriggers(GroupMatcher<TriggerKey>.GroupEquals(schedId));
Assert.AreEqual(1, scheduler.GetPausedTriggerGroups().Count);
Thread.Sleep(TimeSpan.FromSeconds(3));
scheduler.ResumeTriggers(GroupMatcher<TriggerKey>.GroupEquals(schedId));
Assert.IsNotNull(scheduler.GetTrigger(new TriggerKey("trig_2", schedId)));
Assert.IsNotNull(scheduler.GetJobDetail(new JobKey("job_1", schedId)));
Assert.IsNotNull(scheduler.GetMetaData());
Assert.IsNotNull(scheduler.GetCalendar("weeklyCalendar"));
Thread.Sleep(TimeSpan.FromSeconds(20));
scheduler.Standby();
CollectionAssert.IsNotEmpty(scheduler.GetCalendarNames());
CollectionAssert.IsNotEmpty(scheduler.GetJobKeys(GroupMatcher<JobKey>.GroupEquals(schedId)));
CollectionAssert.IsNotEmpty(scheduler.GetTriggersOfJob(new JobKey("job_2", schedId)));
Assert.IsNotNull(scheduler.GetJobDetail(new JobKey("job_2", schedId)));
scheduler.DeleteCalendar("cronCalendar");
scheduler.DeleteCalendar("holidayCalendar");
scheduler.DeleteJob(new JobKey("lonelyJob", "lonelyGroup"));
scheduler.DeleteJob(job.Key);
scheduler.GetJobGroupNames();
scheduler.GetCalendarNames();
scheduler.GetTriggerGroupNames();
}
}
finally
{
scheduler.Shutdown(false);
}
}