/// <inheritdoc />
        public override TriggerScheduleAction Schedule(TriggerScheduleCondition condition, DateTime timeBasisUtc,
                                                       JobExecutionDetails lastJobExecutionDetails)
        {
            timeBasisUtc = DateTimeUtils.AssumeUniversalTime(timeBasisUtc);

            switch (condition)
            {
            case TriggerScheduleCondition.Latch:
                return(ScheduleSuggestedAction(TriggerScheduleAction.Skip, timeBasisUtc));

            case TriggerScheduleCondition.Misfire:
                isFirstTime = false;
                return(ScheduleSuggestedAction(misfireAction, timeBasisUtc));

            case TriggerScheduleCondition.Fire:
                isFirstTime = false;
                return(ScheduleSuggestedAction(TriggerScheduleAction.ExecuteJob, timeBasisUtc));

            default:
                throw new SchedulerException(String.Format(CultureInfo.CurrentCulture,
                                                           "Unrecognized trigger schedule condition '{0}'.", condition));
            }
        }
Пример #2
0
 /// <summary>
 /// Updates the trigger's scheduling state machine in response to a condition
 /// and informs the scheduler as to what action should be taken.
 /// </summary>
 /// <remarks>
 /// The implementation should use the value of the <paramref name="timeBasisUtc"/>
 /// parameter to evaluate its scheduling rules rather than calling <see cref="DateTime.UtcNow" />.
 /// </remarks>
 /// <param name="condition">The reason the trigger is being scheduled</param>
 /// <param name="timeBasisUtc">The UTC time to use as a basis for evaluating scheduling rules and
 /// that should be considered as referring to "Now."</param>
 /// <param name="lastJobExecutionDetails">The results of the most recent job execution which may be
 /// used to provide different trigger responses based on whether a job succeeded or failed.
 /// The value is null if the job has never executed.</param>
 /// <returns>The action that the scheduler should perform in response</returns>
 public abstract TriggerScheduleAction Schedule(TriggerScheduleCondition condition, DateTime timeBasisUtc,
                                                JobExecutionDetails lastJobExecutionDetails);