本文整理汇总了C#中IOperableTrigger.GetPreviousFireTimeUtc方法的典型用法代码示例。如果您正苦于以下问题:C# IOperableTrigger.GetPreviousFireTimeUtc方法的具体用法?C# IOperableTrigger.GetPreviousFireTimeUtc怎么用?C# IOperableTrigger.GetPreviousFireTimeUtc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOperableTrigger
的用法示例。
在下文中一共展示了IOperableTrigger.GetPreviousFireTimeUtc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TriggerFired
protected virtual TriggerFiredBundle TriggerFired(ConnectionAndTransactionHolder conn, IOperableTrigger trigger)
{
IJobDetail job;
ICalendar cal = null;
// Make sure trigger wasn't deleted, paused, or completed...
try
{
// if trigger was deleted, state will be StateDeleted
string state = Delegate.SelectTriggerState(conn, trigger.Key);
if (!state.Equals(StateAcquired))
{
return null;
}
}
catch (Exception e)
{
throw new JobPersistenceException("Couldn't select trigger state: " + e.Message, e);
}
try
{
job = RetrieveJob(conn, trigger.JobKey);
if (job == null)
{
return null;
}
}
catch (JobPersistenceException jpe)
{
try
{
Log.Error("Error retrieving job, setting trigger state to ERROR.", jpe);
Delegate.UpdateTriggerState(conn, trigger.Key, StateError);
}
catch (Exception sqle)
{
Log.Error("Unable to set trigger state to ERROR.", sqle);
}
throw;
}
if (trigger.CalendarName != null)
{
cal = RetrieveCalendar(conn, trigger.CalendarName);
if (cal == null)
{
return null;
}
}
try
{
Delegate.UpdateFiredTrigger(conn, trigger, StateExecuting, job);
}
catch (Exception e)
{
throw new JobPersistenceException("Couldn't insert fired trigger: " + e.Message, e);
}
DateTimeOffset? prevFireTime = trigger.GetPreviousFireTimeUtc();
// call triggered - to update the trigger's next-fire-time state...
trigger.Triggered(cal);
string state2 = StateWaiting;
bool force = true;
if (job.ConcurrentExecutionDisallowed)
{
state2 = StateBlocked;
force = false;
try
{
Delegate.UpdateTriggerStatesForJobFromOtherState(conn, job.Key, StateBlocked, StateWaiting);
Delegate.UpdateTriggerStatesForJobFromOtherState(conn, job.Key, StateBlocked, StateAcquired);
Delegate.UpdateTriggerStatesForJobFromOtherState(conn, job.Key, StatePausedBlocked, StatePaused);
}
catch (Exception e)
{
throw new JobPersistenceException("Couldn't update states of blocked triggers: " + e.Message, e);
}
}
if (!trigger.GetNextFireTimeUtc().HasValue)
{
state2 = StateComplete;
force = true;
}
StoreTrigger(conn, trigger, job, true, state2, force, false);
job.JobDataMap.ClearDirtyFlag();
return new TriggerFiredBundle(
job,
trigger,
cal,
trigger.Key.Group.Equals(SchedulerConstants.DefaultRecoveryGroup),
SystemTime.UtcNow(),
//.........这里部分代码省略.........
示例2: PopulateBaseTriggerProperties
internal static void PopulateBaseTriggerProperties(IOperableTrigger quartzTrigger, DbAbstractTrigger dbTrigger, string instanceName)
{
dbTrigger.CalendarName = quartzTrigger.CalendarName;
dbTrigger.Description = quartzTrigger.Description;
dbTrigger.JobGroup = quartzTrigger.JobKey.Group;
dbTrigger.JobName = quartzTrigger.JobKey.Name;
dbTrigger.MisfireInstruction = quartzTrigger.MisfireInstruction;
dbTrigger.Priority = quartzTrigger.Priority;
dbTrigger.Scheduler = instanceName;
if (quartzTrigger.JobDataMap != null)
{
dbTrigger.JobData = new List<DbJobData>();
foreach (var jobDataItem in quartzTrigger.JobDataMap)
{
DbJobData dbJobData = new DbJobData();
dbJobData.Key = jobDataItem.Key;
dbJobData.Value = jobDataItem.Value;
dbJobData.Type = GetStorableJobTypeName(jobDataItem.Value.GetType());
dbTrigger.JobData.Add(dbJobData);
}
}
dbTrigger.StartTime = new DateEpoch { Date = quartzTrigger.StartTimeUtc.UtcDateTime };
var endTime = quartzTrigger.EndTimeUtc;
if (endTime.HasValue)
dbTrigger.EndTime = new DateEpoch { Date = endTime.Value.UtcDateTime };
var nextFireTime = quartzTrigger.GetNextFireTimeUtc();
if (nextFireTime.HasValue)
dbTrigger.NextFireTime = new DateEpoch { Date = nextFireTime.Value.UtcDateTime };
var previousFireTime = quartzTrigger.GetPreviousFireTimeUtc();
if (previousFireTime.HasValue)
dbTrigger.PreviousFireTime = new DateEpoch { Date = previousFireTime.Value.UtcDateTime };
}