本文整理汇总了C#中Quartz.Core.QuartzScheduler类的典型用法代码示例。如果您正苦于以下问题:C# QuartzScheduler类的具体用法?C# QuartzScheduler怎么用?C# QuartzScheduler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QuartzScheduler类属于Quartz.Core命名空间,在下文中一共展示了QuartzScheduler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SchedulerSignalerImpl
public SchedulerSignalerImpl(QuartzScheduler sched, QuartzSchedulerThread schedThread)
{
this.sched = sched;
this.schedThread = schedThread;
log.Info("Initialized Scheduler Signaller of type: " + GetType());
}
示例2: Initialize
/// <summary>
/// Initializes the job execution context with given scheduler and bundle.
/// </summary>
/// <param name="sched">The scheduler.</param>
public virtual async Task Initialize(QuartzScheduler sched)
{
qs = sched;
IJob job;
IJobDetail jobDetail = firedTriggerBundle.JobDetail;
try
{
job = sched.JobFactory.NewJob(firedTriggerBundle, scheduler);
}
catch (SchedulerException se)
{
await sched.NotifySchedulerListenersError($"An error occurred instantiating job to be executed. job= '{jobDetail.Key}'", se).ConfigureAwait(false);
throw;
}
catch (Exception e)
{
SchedulerException se = new SchedulerException($"Problem instantiating type '{jobDetail.JobType.FullName}'", e);
await sched.NotifySchedulerListenersError($"An error occurred instantiating job to be executed. job= '{jobDetail.Key}'", se).ConfigureAwait(false);
throw se;
}
jec = new JobExecutionContextImpl(scheduler, firedTriggerBundle, job);
}
示例3: Initialize
/// <summary>
/// Initializes the job execution context with given scheduler and bundle.
/// </summary>
/// <param name="sched">The scheduler.</param>
public virtual void Initialize(QuartzScheduler sched)
{
qs = sched;
IJob job;
IJobDetail jobDetail = firedTriggerBundle.JobDetail;
try
{
job = sched.JobFactory.NewJob(firedTriggerBundle, scheduler);
}
catch (SchedulerException se)
{
sched.NotifySchedulerListenersError(string.Format(CultureInfo.InvariantCulture, "An error occured instantiating job to be executed. job= '{0}'", jobDetail.Key), se);
throw;
}
catch (Exception e)
{
SchedulerException se = new SchedulerException(string.Format(CultureInfo.InvariantCulture, "Problem instantiating type '{0}'", jobDetail.JobType.FullName), e);
sched.NotifySchedulerListenersError(string.Format(CultureInfo.InvariantCulture, "An error occured instantiating job to be executed. job= '{0}'", jobDetail.Key), se);
throw se;
}
jec = new JobExecutionContextImpl(scheduler, firedTriggerBundle, job);
}
示例4: QuartzSchedulerThread
/// <summary>
/// Construct a new <see cref="QuartzSchedulerThread" /> for the given
/// <see cref="QuartzScheduler" /> as a <see cref="Thread" /> with the given
/// attributes.
/// </summary>
internal QuartzSchedulerThread(QuartzScheduler qs, QuartzSchedulerResources qsRsrcs,
bool setDaemon, int threadPrio)
: base(qsRsrcs.ThreadName)
{
//ThreadGroup generatedAux = qs.SchedulerThreadGroup;
this.qs = qs;
this.qsRsrcs = qsRsrcs;
IsBackground = setDaemon;
Priority = (ThreadPriority) threadPrio;
// start the underlying thread, but put this object into the 'paused'
// state
// so processing doesn't start yet...
paused = true;
halted = false;
}
示例5: SchedulerSignalerImpl
public SchedulerSignalerImpl(QuartzScheduler sched, QuartzSchedulerThread schedThread)
{
this.sched = sched;
this.schedThread = schedThread;
}
示例6: QuartzSchedulerThread
/// <summary>
/// Construct a new <see cref="QuartzSchedulerThread" /> for the given
/// <see cref="QuartzScheduler" /> as a non-daemon <see cref="Thread" />
/// with normal priority.
/// </summary>
internal QuartzSchedulerThread(QuartzScheduler qs, QuartzSchedulerResources qsRsrcs)
: this(qs, qsRsrcs, qsRsrcs.MakeSchedulerThreadDaemon, (int) ThreadPriority.Normal)
{
}
示例7: DelayedSchedulerStarter
public DelayedSchedulerStarter(QuartzScheduler scheduler, TimeSpan delay)
{
this.scheduler = scheduler;
this.delay = delay;
}
示例8: SetFactory
protected void SetFactory(QuartzScheduler qs)
{
qs.JobFactory = _unityJobFactory;
}
示例9: Instantiate
protected override IScheduler Instantiate(QuartzSchedulerResources rsrcs, QuartzScheduler qs)
{
SetFactory(qs);
return base.Instantiate(rsrcs, qs);
}
示例10: StdScheduler
/// <summary>
/// Construct a <see cref="StdScheduler" /> instance to proxy the given
/// <see cref="QuartzScheduler" /> instance.
/// </summary>
public StdScheduler(QuartzScheduler sched)
{
this.sched = sched;
}
示例11: Instantiate
protected override IScheduler Instantiate(QuartzSchedulerResources rsrcs, QuartzScheduler qs)
{
var scheduler = base.Instantiate(rsrcs, qs);
scheduler.JobFactory = _abpJobFactory;
return scheduler;
}
示例12: Run
/// <summary>
/// The main processing loop of the <see cref="QuartzSchedulerThread" />.
/// </summary>
public override void Run()
{
bool lastAcquireFailed = false;
while (!halted)
{
try
{
// check if we're supposed to pause...
lock (sigLock)
{
while (paused && !halted)
{
try
{
// wait until togglePause(false) is called...
Monitor.Wait(sigLock, 1000);
}
catch (ThreadInterruptedException)
{
}
}
if (halted)
{
break;
}
}
int availTreadCount = qsRsrcs.ThreadPool.BlockForAvailableThreads();
if (availTreadCount > 0) // will always be true, due to semantics of blockForAvailableThreads...
{
Trigger trigger = null;
DateTime now = DateTime.UtcNow;
ClearSignaledSchedulingChange();
try
{
trigger = qsRsrcs.JobStore.AcquireNextTrigger(ctxt, now.Add(idleWaitTime));
lastAcquireFailed = false;
}
catch (JobPersistenceException jpe)
{
if (!lastAcquireFailed)
{
qs.NotifySchedulerListenersError(
"An error occured while scanning for the next trigger to fire.",
jpe);
}
lastAcquireFailed = true;
}
catch (Exception e)
{
if (!lastAcquireFailed)
{
Log.Error("quartzSchedulerThreadLoop: RuntimeException "
+ e.Message, e);
}
lastAcquireFailed = true;
}
if (trigger != null)
{
now = DateTime.UtcNow;
DateTime triggerTime = trigger.GetNextFireTimeUtc().Value;
TimeSpan timeUntilTrigger = triggerTime - now;
while (timeUntilTrigger > TimeSpan.Zero)
{
lock (sigLock)
{
try
{
// we could have blocked a long while
// on 'synchronize', so we must recompute
now = DateTime.UtcNow;
timeUntilTrigger = triggerTime - now;
if (timeUntilTrigger.TotalMilliseconds >= 1)
{
Monitor.Wait(sigLock, timeUntilTrigger);
}
}
catch (ThreadInterruptedException)
{
}
}
if (IsScheduleChanged())
{
if (IsCandidateNewTimeEarlierWithinReason(triggerTime))
{
// above call does a clearSignaledSchedulingChange()
try
{
qsRsrcs.JobStore.ReleaseAcquiredTrigger(ctxt, trigger);
}
catch (JobPersistenceException jpe)
//.........这里部分代码省略.........
示例13: QuartzSchedulerThread
/// <summary>
/// Construct a new <see cref="QuartzSchedulerThread" /> for the given
/// <see cref="QuartzScheduler" /> as a <see cref="Thread" /> with the given
/// attributes.
/// </summary>
internal QuartzSchedulerThread(QuartzScheduler qs, QuartzSchedulerResources qsRsrcs, SchedulingContext ctxt,
bool setDaemon, int threadPrio) : base(qsRsrcs.ThreadName)
{
log = LogManager.GetLogger(GetType());
//ThreadGroup generatedAux = qs.SchedulerThreadGroup;
this.qs = qs;
this.qsRsrcs = qsRsrcs;
this.ctxt = ctxt;
IsBackground = setDaemon;
Priority = (ThreadPriority) threadPrio;
// start the underlying thread, but put this object into the 'paused'
// state
// so processing doesn't start yet...
paused = true;
halted = false;
Start();
}
示例14: Instantiate
protected override IScheduler Instantiate(QuartzSchedulerResources resources, QuartzScheduler qs)
{
IScheduler scheduler = base.Instantiate(resources, qs);
scheduler.JobFactory = kernel.Resolve<IJobFactory>();
return scheduler;
}
示例15: Instantiate
protected override IScheduler Instantiate(QuartzSchedulerResources resources, QuartzScheduler quartzScheduler) {
var scheduler = base.Instantiate(resources, quartzScheduler);
return scheduler is StdScheduler ? new XpandScheduler(quartzScheduler, _application) : scheduler;
}