本文整理汇总了C#中SchedulerInstruction类的典型用法代码示例。如果您正苦于以下问题:C# SchedulerInstruction类的具体用法?C# SchedulerInstruction怎么用?C# SchedulerInstruction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SchedulerInstruction类属于命名空间,在下文中一共展示了SchedulerInstruction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TriggerComplete
public override void TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode)
{
Log.TraceFormat("Trigger complete for job {0} with scheduler instruction {1}",
context.JobDetail.JobType,
triggerInstructionCode
);
}
开发者ID:mattgwagner,项目名称:Task-Processor,代码行数:7,代码来源:TriggerListener.cs
示例2: TriggerComplete
/// <summary>
/// Called by the <see cref="IScheduler" /> when a <see cref="ITrigger" />
/// has fired, it's associated <see cref="IJobDetail" />
/// has been executed, and it's <see cref="IOperableTrigger.Triggered" /> method has been
/// called.
/// </summary>
/// <param name="trigger"></param>
/// <param name="context"></param>
/// <param name="triggerInstructionCode"></param>
public void TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode)
{
Logger.InfoFormat("TriggerComplete: {0}, {1}", trigger.Key.Name, trigger.Key.Group);
var auditLog = GetAuditLog(trigger, "TriggerComplete", context);
_persistanceStore.InsertAuditLog(auditLog);
}
开发者ID:R-Suite,项目名称:R.Scheduler,代码行数:16,代码来源:AuditTriggerListener.cs
示例3: TriggerComplete
public void TriggerComplete(Trigger trigger, JobExecutionContext context, SchedulerInstruction triggerInstructionCode)
{
if (!trigger.Name.Equals("TimerTrigger"))
{
Account account = (Account)trigger.JobDataMap.Get("account");
if (account != null)
{
SimpleTrigger triggerObject = new SimpleTrigger(account.Login + "Trigger", "account", DateTime.MinValue, null, 0, TimeSpan.Zero);
triggerObject.JobName = account.Login + "Job";
triggerObject.StartTimeUtc = DateTime.UtcNow.AddSeconds(new Random().Next(account.Settings.NextTimeLoginMin, account.Settings.NextTimeLoginMax));
account.SchedulerTrigger = triggerObject;
triggerObject.JobDataMap.Add("account", account);
m_accountManager.SetNextLoginTimeForAccount(account);
}
}
}
开发者ID:wrobeseb,项目名称:parRobot,代码行数:16,代码来源:AccountTriggerListener.cs
示例4: TriggerComplete
public void TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode)
{
try
{
//var executationDuration = (DateTime.UtcNow - trigger.GetPreviousFireTimeUtc()).Value.TotalSeconds;
var executionDuration = context.JobRunTime.TotalSeconds;
TriggerStatistic triggerStat = new TriggerStatistic()
{
Group = trigger.Key.Group,
JobKey = trigger.JobKey.Name,
TriggerKey = trigger.Key.Name,
ExecutionDurationInSeconds = executionDuration,
StartTime = trigger.GetPreviousFireTimeUtc().Value.DateTime.ToLocalTime(),
FinishTime = DateTime.Now
};
Sitecore.Diagnostics.Log.Info(String.Format("Job {0} with trigger {1} Completed @ {2} and it took {3} seconds ", triggerStat.JobKey, triggerStat.TriggerKey, DateTime.Now, triggerStat.ExecutionDurationInSeconds), this);
string triggerStatProviderType = Settings.GetSetting("Sitecore.QuartzScheduler.TriggerStatisticsStoreProvider");
if (!String.IsNullOrEmpty(triggerStatProviderType))
{
var triggerStatsProvider = Activator.CreateInstance(Type.GetType(triggerStatProviderType)) as ITriggerStatisticsStore;
triggerStatsProvider.SaveTriggerStatistic(triggerStat);
}
else
{
Sitecore.Diagnostics.Log.Warn("Sitecore.QuartzScheuler: Missing App Setting value for Sitecore.QuartzScheduler.TriggerStatisticsStoreProvider", this);
}
}
catch(Exception ex)
{
Sitecore.Diagnostics.Log.Error("Exception in TriggerComplete: " + ex.Message + Environment.NewLine + ex.StackTrace, this);
}
}
开发者ID:badalk,项目名称:Scheduler,代码行数:36,代码来源:SchedulerTriggerListener.cs
示例5: NotifyTriggerListenersComplete
/// <summary>
/// Notifies the trigger listeners of completion.
/// </summary>
/// <param name="jec">The job executution context.</param>
/// <param name="instCode">The instruction code to report to triggers.</param>
public virtual void NotifyTriggerListenersComplete(IJobExecutionContext jec, SchedulerInstruction instCode)
{
// build a list of all trigger listeners that are to be notified...
IEnumerable<ITriggerListener> listeners = BuildTriggerListenerList();
// notify all trigger listeners in the list
foreach (ITriggerListener tl in listeners)
{
if (!MatchTriggerListener(tl, jec.Trigger.Key))
{
continue;
}
try
{
tl.TriggerComplete(jec.Trigger, jec, instCode);
}
catch (Exception e)
{
SchedulerException se = new SchedulerException(string.Format(CultureInfo.InvariantCulture, "TriggerListener '{0}' threw exception: {1}", tl.Name, e.Message), e);
throw se;
}
}
}
开发者ID:natenho,项目名称:quartznet,代码行数:28,代码来源:QuartzScheduler.cs
示例6: TriggerComplete
public void TriggerComplete(ITrigger trigger,
IJobExecutionContext context,
SchedulerInstruction triggerInstructionCode)
{
}
开发者ID:CharlieBP,项目名称:quartznet,代码行数:5,代码来源:SchedulerListenerTest.cs
示例7: TriggerComplete
public Task TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode)
{
return Task.WhenAll(listeners.Select(l => l.TriggerComplete(trigger, context, triggerInstructionCode)));
}
开发者ID:jvilalta,项目名称:quartznet,代码行数:4,代码来源:BroadcastTriggerListener.cs
示例8: TriggeredJobComplete
protected virtual void TriggeredJobComplete(ConnectionAndTransactionHolder conn,
IOperableTrigger trigger,
IJobDetail jobDetail, SchedulerInstruction triggerInstCode)
{
try
{
if (triggerInstCode == SchedulerInstruction.DeleteTrigger)
{
if (!trigger.GetNextFireTimeUtc().HasValue)
{
// double check for possible reschedule within job
// execution, which would cancel the need to delete...
TriggerStatus stat = Delegate.SelectTriggerStatus(conn, trigger.Key);
if (stat != null && !stat.NextFireTimeUtc.HasValue)
{
RemoveTrigger(conn, trigger.Key);
}
}
else
{
RemoveTrigger(conn, trigger.Key);
SignalSchedulingChangeOnTxCompletion(null);
}
}
else if (triggerInstCode == SchedulerInstruction.SetTriggerComplete)
{
Delegate.UpdateTriggerState(conn, trigger.Key, StateComplete);
SignalSchedulingChangeOnTxCompletion(null);
}
else if (triggerInstCode == SchedulerInstruction.SetTriggerError)
{
Log.Info("Trigger " + trigger.Key + " set to ERROR state.");
Delegate.UpdateTriggerState(conn, trigger.Key, StateError);
SignalSchedulingChangeOnTxCompletion(null);
}
else if (triggerInstCode == SchedulerInstruction.SetAllJobTriggersComplete)
{
Delegate.UpdateTriggerStatesForJob(conn, trigger.JobKey, StateComplete);
SignalSchedulingChangeOnTxCompletion(null);
}
else if (triggerInstCode == SchedulerInstruction.SetAllJobTriggersError)
{
Log.Info("All triggers of Job " + trigger.JobKey + " set to ERROR state.");
Delegate.UpdateTriggerStatesForJob(conn, trigger.JobKey, StateError);
SignalSchedulingChangeOnTxCompletion(null);
}
if (jobDetail.ConcurrentExecutionDisallowed)
{
Delegate.UpdateTriggerStatesForJobFromOtherState(conn, jobDetail.Key, StateWaiting, StateBlocked);
Delegate.UpdateTriggerStatesForJobFromOtherState(conn, jobDetail.Key, StatePaused, StatePausedBlocked);
SignalSchedulingChangeOnTxCompletion(null);
}
if (jobDetail.PersistJobDataAfterExecution)
{
try
{
if (jobDetail.JobDataMap.Dirty)
{
Delegate.UpdateJobData(conn, jobDetail);
}
}
catch (IOException e)
{
throw new JobPersistenceException("Couldn't serialize job data: " + e.Message, e);
}
catch (Exception e)
{
throw new JobPersistenceException("Couldn't update job data: " + e.Message, e);
}
}
}
catch (Exception e)
{
throw new JobPersistenceException("Couldn't update trigger state(s): " + e.Message, e);
}
try
{
Delegate.DeleteFiredTrigger(conn, trigger.FireInstanceId);
}
catch (Exception e)
{
throw new JobPersistenceException("Couldn't delete fired trigger: " + e.Message, e);
}
}
开发者ID:valeriob,项目名称:quartznet,代码行数:86,代码来源:JobStoreSupport.cs
示例9: TriggerComplete
public Task TriggerComplete(ITrigger trigger,
IJobExecutionContext context,
SchedulerInstruction triggerInstructionCode)
{
return TaskUtil.CompletedTask;
}
开发者ID:jvilalta,项目名称:quartznet,代码行数:6,代码来源:SchedulerListenerTest.cs
示例10: VetoedJobRetryLoop
/// <summary>
/// Vetoeds the job retry loop.
/// </summary>
/// <param name="trigger">The trigger.</param>
/// <param name="jobDetail">The job detail.</param>
/// <param name="instCode">The inst code.</param>
/// <returns></returns>
public bool VetoedJobRetryLoop(Trigger trigger, JobDetail jobDetail, SchedulerInstruction instCode)
{
while (!shutdownRequested)
{
try
{
Thread.Sleep(5 * 1000); // retry every 5 seconds (the db
// connection must be failed)
qs.NotifyJobStoreJobVetoed(schdCtxt, trigger, jobDetail, instCode);
return true;
}
catch (JobPersistenceException jpe)
{
qs.NotifySchedulerListenersError(
string.Format(CultureInfo.InvariantCulture, "An error occured while marking executed job vetoed. job= '{0}'", jobDetail.FullName), jpe);
}
catch (ThreadInterruptedException)
{
}
}
return false;
}
开发者ID:kisflying,项目名称:kion,代码行数:29,代码来源:JobRunShell.cs
示例11: TriggeredJobComplete
public void TriggeredJobComplete(Trigger trigger, IScheduledJob job, SchedulerInstruction triggerInstCode)
{
lock (_triggerLock)
{
JobWrapper jw = _jobsDictionary[job.Name] as JobWrapper;
TriggerWrapper tw = _triggersDictionary[trigger.Name] as TriggerWrapper;
// even if it was deleted, there may be cleanup to do
_blockedJobs.Remove(job.Name);
// check for trigger deleted during execution...
if (tw != null)
{
if (triggerInstCode == SchedulerInstruction.DeleteTrigger)
{
//log.Debug("Deleting trigger");
NullableDateTime d = trigger.GetNextFireTimeUtc();
if (!d.HasValue)
{
// double check for possible reschedule within job
// execution, which would cancel the need to delete...
d = tw.Trigger.GetNextFireTimeUtc();
if (!d.HasValue)
{
RemoveTrigger(trigger.Name);
}
else
{
log.Debug("Deleting cancelled - trigger still active");
}
}
else
{
RemoveTrigger(trigger.Name);
}
}
else if (triggerInstCode == SchedulerInstruction.SetTriggerComplete)
{
tw.State = InternalTriggerState.Complete;
_timeTriggers.Remove(tw);
}
else if (triggerInstCode == SchedulerInstruction.SetTriggerError)
{
log.Info(string.Format(CultureInfo.InvariantCulture, "Trigger {0} set to ERROR state.", trigger.Name));
tw.State = InternalTriggerState.Error;
}
else if (triggerInstCode == SchedulerInstruction.SetAllJobTriggersError)
{
log.Info(string.Format(CultureInfo.InvariantCulture, "All triggers of Job {0} set to ERROR state.", trigger.Name));
SetAllTriggersOfJobToState(trigger.Name, InternalTriggerState.Error);
}
else if (triggerInstCode == SchedulerInstruction.SetAllJobTriggersComplete)
{
SetAllTriggersOfJobToState(trigger.Name, InternalTriggerState.Complete);
}
}
}
}
开发者ID:ResQue1980,项目名称:LoLTeamChecker,代码行数:58,代码来源:SchedulingService.cs
示例12: TriggerComplete
public void TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode)
{
Write("{0} -- {1} -- Trigger ({2}) completed", Name, DateTime.Now, trigger.Key);
}
开发者ID:cknightdevelopment,项目名称:CodeIn60Seconds,代码行数:4,代码来源:TriggerListener.cs
示例13: NotifyJobStoreJobComplete
/// <summary>
/// Notifies the job store job complete.
/// </summary>
/// <param name="trigger">The trigger.</param>
/// <param name="detail">The detail.</param>
/// <param name="instCode">The instruction code.</param>
public virtual void NotifyJobStoreJobComplete(IOperableTrigger trigger, IJobDetail detail, SchedulerInstruction instCode)
{
resources.JobStore.TriggeredJobComplete(trigger, detail, instCode);
}
开发者ID:NathanBaulch,项目名称:quartznet,代码行数:10,代码来源:QuartzScheduler.cs
示例14: TriggeredJobCompleteCallback
public TriggeredJobCompleteCallback(JobStoreSupport js, SchedulingContext ctxt, Trigger trigger,
SchedulerInstruction triggerInstCode, JobDetail jobDetail)
: base(js)
{
this.ctxt = ctxt;
this.trigger = trigger;
this.triggerInstCode = triggerInstCode;
this.jobDetail = jobDetail;
}
开发者ID:djvit-iteelabs,项目名称:Infosystem.Scraper,代码行数:9,代码来源:JobStoreSupport.cs
示例15: TriggeredJobComplete
/// <summary>
/// Inform the <see cref="IJobStore" /> that the scheduler has completed the
/// firing of the given <see cref="Trigger" /> (and the execution its
/// associated <see cref="IJob" />), and that the <see cref="JobDataMap" />
/// in the given <see cref="JobDetail" /> should be updated if the <see cref="IJob" />
/// is stateful.
/// </summary>
public virtual void TriggeredJobComplete(SchedulingContext ctxt, Trigger trigger, JobDetail jobDetail,
SchedulerInstruction triggerInstCode)
{
ExecuteInNonManagedTXLock(LockTriggerAccess,
new TriggeredJobCompleteCallback(this, ctxt, trigger, triggerInstCode, jobDetail));
}
开发者ID:djvit-iteelabs,项目名称:Infosystem.Scraper,代码行数:13,代码来源:JobStoreSupport.cs
示例16: NotifyTriggerListenersComplete
private bool NotifyTriggerListenersComplete(JobExecutionContext ctx, SchedulerInstruction instCode)
{
try
{
qs.NotifyTriggerListenersComplete(ctx, instCode);
}
catch (SchedulerException se)
{
qs.NotifySchedulerListenersError(
string.Format(CultureInfo.InvariantCulture, "Unable to notify TriggerListener(s) of Job that was executed: (error will be ignored). trigger= {0} job= {1}", ctx.Trigger.FullName, ctx.JobDetail.FullName), se);
return false;
}
if (!ctx.Trigger.GetNextFireTimeUtc().HasValue)
{
qs.NotifySchedulerListenersFinalized(ctx.Trigger);
}
return true;
}
开发者ID:kisflying,项目名称:kion,代码行数:21,代码来源:JobRunShell.cs
示例17: CompleteTriggerRetryLoop
/// <summary>
/// Completes the trigger retry loop.
/// </summary>
/// <param name="trigger">The trigger.</param>
/// <param name="jobDetail">The job detail.</param>
/// <param name="instCode">The inst code.</param>
/// <returns></returns>
public virtual bool CompleteTriggerRetryLoop(Trigger trigger, JobDetail jobDetail, SchedulerInstruction instCode)
{
long count = 0;
while (!shutdownRequested)
{ // FIXME: jhouse: note that there is no longer anthing that calls requestShutdown()
try
{
Thread.Sleep(TimeSpan.FromSeconds(15));
// retry every 15 seconds (the db
// connection must be failed)
qs.NotifyJobStoreJobComplete(schdCtxt, trigger, jobDetail, instCode);
return true;
}
catch (JobPersistenceException jpe)
{
if (count % 4 == 0)
qs.NotifySchedulerListenersError(
"An error occured while marking executed job complete (will continue attempts). job= '"
+ jobDetail.FullName + "'", jpe);
}
catch (ThreadInterruptedException)
{
}
count++;
}
return false;
}
开发者ID:kisflying,项目名称:kion,代码行数:34,代码来源:JobRunShell.cs
示例18: TriggeredJobComplete
/// <summary>
/// Inform the <see cref="T:Quartz.Spi.IJobStore"/> that the scheduler has completed the
/// firing of the given <see cref="T:Quartz.ITrigger"/> (and the execution its
/// associated <see cref="T:Quartz.IJob"/>), and that the <see cref="T:Quartz.JobDataMap"/>
/// in the given <see cref="T:Quartz.IJobDetail"/> should be updated if the <see cref="T:Quartz.IJob"/>
/// is stateful.
/// </summary>
public override void TriggeredJobComplete(IOperableTrigger trigger, IJobDetail jobDetail, SchedulerInstruction triggerInstCode)
{
var jobHashKey = this.RedisJobStoreSchema.JobHashKey(jobDetail.Key);
var jobDataMapHashKey = this.RedisJobStoreSchema.JobDataMapHashKey(jobDetail.Key);
var triggerHashKey = this.RedisJobStoreSchema.TriggerHashkey(trigger.Key);
if (this.Db.KeyExists(jobHashKey))
{
Logger.InfoFormat("{0} - Job has completed", jobHashKey);
if (jobDetail.PersistJobDataAfterExecution)
{
var jobDataMap = jobDetail.JobDataMap;
Db.KeyDelete(jobDataMapHashKey);
if (jobDataMap != null && !jobDataMap.IsEmpty)
{
Db.HashSet(jobDataMapHashKey, ConvertToHashEntries(jobDataMap));
}
}
if (jobDetail.ConcurrentExecutionDisallowed)
{
Db.SetRemove(this.RedisJobStoreSchema.BlockedJobsSet(), jobHashKey);
Db.KeyDelete(this.RedisJobStoreSchema.JobBlockedKey(jobDetail.Key));
var jobTriggersSetKey = this.RedisJobStoreSchema.JobTriggersSetKey(jobDetail.Key);
foreach (var nonConcurrentTriggerHashKey in this.Db.SetMembers(jobTriggersSetKey))
{
var score =
this.Db.SortedSetScore(this.RedisJobStoreSchema.TriggerStateSetKey(RedisTriggerState.Blocked),
nonConcurrentTriggerHashKey);
if (score.HasValue)
{
this.SetTriggerState(RedisTriggerState.Paused, score.Value, nonConcurrentTriggerHashKey);
}
else
{
score =
this.Db.SortedSetScoreAsync(
this.RedisJobStoreSchema.TriggerStateSetKey(RedisTriggerState.PausedBlocked),
nonConcurrentTriggerHashKey).Result;
if (score.HasValue)
{
this.SetTriggerState(RedisTriggerState.Paused, score.Value, nonConcurrentTriggerHashKey);
}
}
}
this.SchedulerSignaler.SignalSchedulingChange(null);
}
}
else
{
this.Db.SetRemove(this.RedisJobStoreSchema.BlockedJobsSet(), jobHashKey);
}
if (this.Db.KeyExists(triggerHashKey))
{
if (triggerInstCode == SchedulerInstruction.DeleteTrigger)
{
if (trigger.GetNextFireTimeUtc().HasValue == false)
{
if (string.IsNullOrEmpty(this.Db.HashGet(triggerHashKey, RedisJobStoreSchema.NextFireTime)))
{
RemoveTrigger(trigger.Key);
}
}
else
{
this.RemoveTrigger(trigger.Key);
this.SchedulerSignaler.SignalSchedulingChange(null);
}
}
else if (triggerInstCode == SchedulerInstruction.SetTriggerComplete)
{
this.SetTriggerState(RedisTriggerState.Completed, DateTimeOffset.UtcNow.DateTime.ToUnixTimeMilliSeconds(), triggerHashKey);
this.SchedulerSignaler.SignalSchedulingChange(null);
}
else if (triggerInstCode == SchedulerInstruction.SetTriggerError)
{
double score = trigger.GetNextFireTimeUtc().HasValue
? trigger.GetNextFireTimeUtc().Value.DateTime.ToUnixTimeMilliSeconds() : 0;
this.SetTriggerState(RedisTriggerState.Error, score, triggerHashKey);
this.SchedulerSignaler.SignalSchedulingChange(null);
}
//.........这里部分代码省略.........
开发者ID:icyice80,项目名称:QuartzRedisJobStore,代码行数:101,代码来源:RedisStorage.cs
示例19: TriggerComplete
public virtual void TriggerComplete(Trigger trigger, JobExecutionContext context, SchedulerInstruction triggerInstructionCode)
{
}
开发者ID:kisflying,项目名称:kion,代码行数:3,代码来源:TriggerListenerSupport.cs
示例20: TriggerComplete
public override void TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode) {
entries.Add(new LogEntry("Job complete: " + Describe(context)));
}
开发者ID:weizhong1988,项目名称:QuartzNetWebConsole,代码行数:3,代码来源:MemoryLogger.cs
注:本文中的SchedulerInstruction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论