IMutableTrigger

namespace Quartz.Spi;

/// <summary>
/// Should not be used by end users.
/// </summary>
public interface IMutableTrigger : ITrigger
{
    new TriggerKey Key { set; get; }

    new JobKey JobKey { set; get; }

    /// <summary>
    /// Set a description for the <see cref="ITrigger" /> instance - may be
    /// useful for remembering/displaying the purpose of the trigger, though the
    /// description has no meaning to Quartz.
    /// </summary>
    new string? Description { get; set; }

    /// <summary>
    /// Associate the <see cref="ICalendar" /> with the given name with this Trigger.
    /// </summary>
    new string? CalendarName { set; get; }

    /// <summary>
    /// Set the <see cref="JobDataMap" /> to be associated with the
    /// <see cref="ITrigger" />.
    /// </summary>
    new JobDataMap JobDataMap { get; set; }

    /// <summary>
    /// The priority of a <see cref="ITrigger" /> acts as a tie breaker such that if
    /// two <see cref="ITrigger" />s have the same scheduled fire time, then Quartz
    /// will do its best to give the one with the higher priority first access
    /// to a worker thread.
    /// </summary>
    /// <remarks>
    /// If not explicitly set, the default value is 5.
    /// </remarks>
    /// <seealso cref="TriggerConstants.DefaultPriority" />
    new int Priority { get; set; }

    /// <summary>
    /// <para>
    /// The time at which the trigger's scheduling should start.  May or may not
    /// be the first actual fire time of the trigger, depending upon the type of
    /// trigger and the settings of the other properties of the trigger.  However
    /// the first actual first time will not be before this date.
    /// </para>
    /// <para>
    /// Setting a value in the past may cause a new trigger to compute a first
    /// fire time that is in the past, which may cause an immediate misfire
    /// of the trigger.
    /// </para>
    /// ew DateTimeOffset StartTimeUtc {  get; set; }
    /// </summary>
    new DateTimeOffset StartTimeUtc { get; set; }

    /// <summary>
    /// <para>
    /// Set the time at which the <see cref="ITrigger" /> should quit repeating -
    /// regardless of any remaining repeats (based on the trigger's particular
    /// repeat settings).
    /// </para>
    /// </summary>
    /// <remarks>
    /// </remarks>
    new DateTimeOffset? EndTimeUtc { get; set; }

    /// <summary>
    /// Set the instruction the <see cref="IScheduler" /> should be given for
    /// handling misfire situations for this <see cref="ITrigger" />- the
    /// concrete <see cref="ITrigger" /> type that you are using will have
    /// defined a set of additional MisfireInstruction.XXX
    /// constants that may be passed to this method.
    /// </summary>
    /// <remarks>
    /// If not explicitly set, the default value is <see cref="Quartz.MisfireInstruction.SmartPolicy" />.
    /// </remarks>
    /// <seealso cref="Quartz.MisfireInstruction.SmartPolicy" />
    /// <seealso cref="ISimpleTrigger" />
    /// <seealso cref="ICronTrigger" />
    new int MisfireInstruction { get; set; }
}
View Code
namespace Quartz.Spi;

/// <summary>
/// Internal interface for managing triggers. This interface should not be used by the Quartz client.
/// </summary>
public interface IOperableTrigger : IMutableTrigger
{
    /// <summary>
    /// This method should not be used by the Quartz client.
    /// </summary>
    /// <remarks>
    /// Called when the <see cref="IScheduler" /> has decided to 'fire'
    /// the trigger (Execute the associated <see cref="IJob" />), in order to
    /// give the <see cref="ITrigger" /> a chance to update itself for its next
    /// triggering (if any).
    /// </remarks>
    /// <seealso cref="JobExecutionException" />
    void Triggered(ICalendar? calendar);

    /// <summary>
    /// This method should not be used by the Quartz client.
    /// </summary>
    /// <remarks>
    /// <para>
    /// Called by the scheduler at the time a <see cref="ITrigger" /> is first
    /// added to the scheduler, in order to have the <see cref="ITrigger" />
    /// compute its first fire time, based on any associated calendar.
    /// </para>
    ///
    /// <para>
    /// After this method has been called, <see cref="ITrigger.GetNextFireTimeUtc" />
    /// should return a valid answer.
    /// </para>
    /// </remarks>
    /// <returns>
    /// The first time at which the <see cref="ITrigger" /> will be fired
    /// by the scheduler, which is also the same value <see cref="ITrigger.GetNextFireTimeUtc" />
    /// will return (until after the first firing of the <see cref="ITrigger" />).
    /// </returns>
    DateTimeOffset? ComputeFirstFireTimeUtc(ICalendar? calendar);

    /// <summary>
    /// This method should not be used by the Quartz client.
    /// </summary>
    /// <remarks>
    /// Called after the <see cref="IScheduler" /> has executed the
    /// <see cref="IJobDetail" /> associated with the <see cref="ITrigger" />
    /// in order to get the final instruction code from the trigger.
    /// </remarks>
    /// <param name="context">
    /// is the <see cref="IJobExecutionContext" /> that was used by the
    /// <see cref="IJob" />'s<see cref="IJob.Execute" /> method.</param>
    /// <param name="result">is the <see cref="JobExecutionException" /> thrown by the
    /// <see cref="IJob" />, if any (may be null).
    /// </param>
    /// <returns>
    /// One of the <see cref="SchedulerInstruction"/> members.
    /// </returns>
    /// <seealso cref="SchedulerInstruction.NoInstruction" />
    /// <seealso cref="SchedulerInstruction.ReExecuteJob" />
    /// <seealso cref="SchedulerInstruction.DeleteTrigger" />
    /// <seealso cref="SchedulerInstruction.SetTriggerComplete" />
    /// <seealso cref="Triggered" />
    SchedulerInstruction ExecutionComplete(IJobExecutionContext context, JobExecutionException? result);

    /// <summary>
    /// This method should not be used by the Quartz client.
    /// <para>
    /// To be implemented by the concrete classes that extend this class.
    /// </para>
    /// <para>
    /// The implementation should update the <see cref="ITrigger" />'s state
    /// based on the MISFIRE_INSTRUCTION_XXX that was selected when the <see cref="ITrigger" />
    /// was created.
    /// </para>
    /// </summary>
    void UpdateAfterMisfire(ICalendar? cal);

    /// <summary>
    /// This method should not be used by the Quartz client.
    /// <para>
    /// The implementation should update the <see cref="ITrigger" />'s state
    /// based on the given new version of the associated <see cref="ICalendar" />
    /// (the state should be updated so that it's next fire time is appropriate
    /// given the Calendar's new settings).
    /// </para>
    /// </summary>
    /// <param name="cal"> </param>
    /// <param name="misfireThreshold"></param>
    void UpdateWithNewCalendar(ICalendar cal, TimeSpan misfireThreshold);

    /// <summary>
    /// Validates whether the properties of the <see cref="IJobDetail" /> are
    /// valid for submission into a <see cref="IScheduler" />.
    /// </summary>
    void Validate();

    /// <summary>
    /// This method should not be used by the Quartz client.
    /// </summary>
    /// <remarks>
    /// Usable by <see cref="IJobStore" />
    /// implementations, in order to facilitate 'recognizing' instances of fired
    /// <see cref="ITrigger" /> s as their jobs complete execution.
    /// </remarks>
    string FireInstanceId { get; set; }

    void SetNextFireTimeUtc(DateTimeOffset? value);

    void SetPreviousFireTimeUtc(DateTimeOffset? value);
}
View Code

 

posted @ 2024-01-11 22:44  VarForrest  阅读(2)  评论(0编辑  收藏  举报