本文整理汇总了C#中Quartz.Core.QuartzScheduler.AddGlobalTriggerListener方法的典型用法代码示例。如果您正苦于以下问题:C# QuartzScheduler.AddGlobalTriggerListener方法的具体用法?C# QuartzScheduler.AddGlobalTriggerListener怎么用?C# QuartzScheduler.AddGlobalTriggerListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quartz.Core.QuartzScheduler
的用法示例。
在下文中一共展示了QuartzScheduler.AddGlobalTriggerListener方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Instantiate
//.........这里部分代码省略.........
catch (Exception e)
{
Log.Error("Couldn't generate instance Id!", e);
throw new SystemException("Cannot run without an instance id.");
}
}
if (js is JobStoreSupport)
{
JobStoreSupport jjs = (JobStoreSupport) js;
jjs.InstanceId = schedInstId;
jjs.DbRetryInterval = dbFailureRetry;
}
QuartzSchedulerResources rsrcs = new QuartzSchedulerResources();
rsrcs.Name = schedName;
rsrcs.ThreadName = threadName;
rsrcs.InstanceId = schedInstId;
rsrcs.JobRunShellFactory = jrsf;
rsrcs.MakeSchedulerThreadDaemon = makeSchedulerThreadDaemon;
rsrcs.ThreadPool = tp;
rsrcs.SchedulerExporter = exporter;
if (tp is SimpleThreadPool)
{
((SimpleThreadPool) tp).ThreadNamePrefix = schedName + "_Worker";
}
tp.Initialize();
rsrcs.JobStore = js;
// add plugins
for (int i = 0; i < plugins.Length; i++)
{
rsrcs.AddSchedulerPlugin(plugins[i]);
}
schedCtxt = new SchedulingContext();
schedCtxt.InstanceId = rsrcs.InstanceId;
qs = new QuartzScheduler(rsrcs, schedCtxt, idleWaitTime, dbFailureRetry);
// Create Scheduler ref...
IScheduler sched = Instantiate(rsrcs, qs);
// set job factory if specified
if (jobFactory != null)
{
qs.JobFactory = jobFactory;
}
// Initialize plugins now that we have a Scheduler instance.
for (int i = 0; i < plugins.Length; i++)
{
plugins[i].Initialize(pluginNames[i], sched);
}
// add listeners
for (int i = 0; i < jobListeners.Length; i++)
{
qs.AddGlobalJobListener(jobListeners[i]);
}
for (int i = 0; i < triggerListeners.Length; i++)
{
qs.AddGlobalTriggerListener(triggerListeners[i]);
}
// set scheduler context data...
IEnumerator itr = new HashSet(schedCtxtProps).GetEnumerator();
while (itr.MoveNext())
{
string key = (String) itr.Current;
string val = schedCtxtProps.Get(key);
sched.Context.Put(key, val);
}
// fire up job store, and runshell factory
js.Initialize(loadHelper, qs.SchedulerSignaler);
jrsf.Initialize(sched, schedCtxt);
Log.Info(string.Format(CultureInfo.InvariantCulture, "Quartz scheduler '{0}' initialized", sched.SchedulerName));
Log.Info(string.Format(CultureInfo.InvariantCulture, "Quartz scheduler version: {0}", qs.Version));
// prevents the repository from being garbage collected
qs.AddNoGCObject(schedRep);
// prevents the db manager from being garbage collected
if (dbMgr != null)
{
qs.AddNoGCObject(dbMgr);
}
schedRep.Bind(sched);
return sched;
}