本文整理汇总了C#中ITrigger.GetPreviousFireTimeUtc方法的典型用法代码示例。如果您正苦于以下问题:C# ITrigger.GetPreviousFireTimeUtc方法的具体用法?C# ITrigger.GetPreviousFireTimeUtc怎么用?C# ITrigger.GetPreviousFireTimeUtc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITrigger
的用法示例。
在下文中一共展示了ITrigger.GetPreviousFireTimeUtc方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例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">The <see cref="ITrigger" /> that was fired.</param>
/// <param name="context">The <see cref="IJobExecutionContext" /> that was passed to the
/// <see cref="IJob" />'s <see cref="IJob.Execute" /> method.</param>
/// <param name="triggerInstructionCode">The result of the call on the <see cref="IOperableTrigger" />'s <see cref="IOperableTrigger.Triggered" /> method.</param>
public virtual void TriggerComplete(ITrigger trigger, IJobExecutionContext context, SchedulerInstruction triggerInstructionCode)
{
string instrCode = "UNKNOWN";
if (triggerInstructionCode == SchedulerInstruction.DeleteTrigger)
{
instrCode = "DELETE TRIGGER";
}
else if (triggerInstructionCode == SchedulerInstruction.NoInstruction)
{
instrCode = "DO NOTHING";
}
else if (triggerInstructionCode == SchedulerInstruction.ReExecuteJob)
{
instrCode = "RE-EXECUTE JOB";
}
else if (triggerInstructionCode ==SchedulerInstruction.SetAllJobTriggersComplete)
{
instrCode = "SET ALL OF JOB'S TRIGGERS COMPLETE";
}
else if (triggerInstructionCode == SchedulerInstruction.SetTriggerComplete)
{
instrCode = "SET THIS TRIGGER COMPLETE";
}
object[] args =
new object[]
{
trigger.Key.Name, trigger.Key.Group, trigger.GetPreviousFireTimeUtc(), trigger.GetNextFireTimeUtc(), SystemTime.UtcNow(),
context.JobDetail.Key.Name, context.JobDetail.Key.Group, context.RefireCount, triggerInstructionCode, instrCode
};
}
示例3: TriggerMisfired
/// <summary>
/// Called by the <see cref="IScheduler" /> when a <see cref="ITrigger" />
/// has misfired.
/// <para>
/// Consideration should be given to how much time is spent in this method,
/// as it will affect all triggers that are misfiring. If you have lots
/// of triggers misfiring at once, it could be an issue it this method
/// does a lot.
/// </para>
/// </summary>
/// <param name="trigger">The <see cref="ITrigger" /> that has misfired.</param>
public virtual void TriggerMisfired(ITrigger trigger)
{
object[] args =
new object[]
{
trigger.Key.Name, trigger.Key.Group, trigger.GetPreviousFireTimeUtc(), trigger.GetNextFireTimeUtc(), SystemTime.UtcNow(),
trigger.JobKey.Name, trigger.JobKey.Group
};
}
示例4: TriggerFired
/// <summary>
/// Called by the <see cref="IScheduler" /> when a <see cref="ITrigger" />
/// has fired, and it's associated <see cref="IJobDetail" />
/// is about to be executed.
/// <para>
/// It is called before the <see cref="VetoJobExecution" /> method of this
/// interface.
/// </para>
/// </summary>
/// <param name="trigger">The <see cref="ITrigger" /> that has fired.</param>
/// <param name="context">The <see cref="IJobExecutionContext" /> that will be passed to the <see cref="IJob" />'s <see cref="IJob.Execute" /> method.</param>
public virtual void TriggerFired(ITrigger trigger, IJobExecutionContext context)
{
object[] args =
new object[]
{
trigger.Key.Name, trigger.Key.Group, trigger.GetPreviousFireTimeUtc(), trigger.GetNextFireTimeUtc(), SystemTime.UtcNow(),
context.JobDetail.Key.Name, context.JobDetail.Key.Group, context.RefireCount
};
}
示例5: TriggerMisfired
/// <summary>
/// Called by the <see cref="IScheduler" /> when a <see cref="ITrigger" />
/// has misfired.
/// <p>
/// Consideration should be given to how much time is spent in this method,
/// as it will affect all triggers that are misfiring. If you have lots
/// of triggers misfiring at once, it could be an issue it this method
/// does a lot.
/// </p>
/// </summary>
/// <param name="trigger">The <see cref="ITrigger" /> that has misfired.</param>
public virtual void TriggerMisfired(ITrigger trigger)
{
if (!Log.IsInfoEnabled)
{
return;
}
object[] args =
new object[]
{
trigger.Key.Name, trigger.Key.Group, trigger.GetPreviousFireTimeUtc(), trigger.GetNextFireTimeUtc(), SystemTime.UtcNow(),
trigger.JobKey.Name, trigger.JobKey.Group
};
Log.Info(String.Format(CultureInfo.InvariantCulture, TriggerMisfiredMessage, args));
}
示例6: TriggerFired
/// <summary>
/// Called by the <see cref="IScheduler" /> when a <see cref="ITrigger" />
/// has fired, and it's associated <see cref="IJobDetail" />
/// is about to be executed.
/// <p>
/// It is called before the <see cref="VetoJobExecution" /> method of this
/// interface.
/// </p>
/// </summary>
/// <param name="trigger">The <see cref="ITrigger" /> that has fired.</param>
/// <param name="context">The <see cref="IJobExecutionContext" /> that will be passed to the <see cref="IJob" />'s <see cref="IJob.Execute" /> method.</param>
public virtual void TriggerFired(ITrigger trigger, IJobExecutionContext context)
{
if (!Log.IsInfoEnabled)
{
return;
}
object[] args =
new object[]
{
trigger.Key.Name, trigger.Key.Group, trigger.GetPreviousFireTimeUtc(), trigger.GetNextFireTimeUtc(), SystemTime.UtcNow(),
context.JobDetail.Key.Name, context.JobDetail.Key.Group, context.RefireCount
};
Log.Info(String.Format(CultureInfo.InvariantCulture, TriggerFiredMessage, args));
}
示例7: GetTriggerData
private static TriggerData GetTriggerData(IScheduler scheduler, ITrigger trigger)
{
return new TriggerData(trigger.Key.Name, GetTriggerStatus(trigger, scheduler))
{
GroupName = trigger.Key.Group,
StartDate = trigger.StartTimeUtc.DateTime,
EndDate = trigger.EndTimeUtc.ToDateTime(),
NextFireDate = trigger.GetNextFireTimeUtc().ToDateTime(),
PreviousFireDate = trigger.GetPreviousFireTimeUtc().ToDateTime(),
TriggerType = TriggerTypeExtractor.GetFor(trigger)
};
}