C# Класс Quartz.Impl.Triggers.DailyTimeIntervalTriggerImpl

A concrete implementation of DailyTimeIntervalTrigger that is used to fire a IJobDetail based upon daily repeating time intervals.

The trigger will fire every N (IDailyTimeIntervalTrigger.RepeatInterval ) seconds, minutes or hours (see IDailyTimeIntervalTrigger.RepeatInterval) during a given time window on specified days of the week.

For example#1, a trigger can be set to fire every 72 minutes between 8:00 and 11:00 everyday. It's fire times would be 8:00, 9:12, 10:24, then next day would repeat: 8:00, 9:12, 10:24 again.

For example#2, a trigger can be set to fire every 23 minutes between 9:20 and 16:47 Monday through Friday.

On each day, the starting fire time is reset to startTimeOfDay value, and then it will add repeatInterval value to it until the endTimeOfDay is reached. If you set daysOfWeek values, then fire time will only occur during those week days period. Again, remember this trigger will reset fire time each day with startTimeOfDay, regardless of your interval or endTimeOfDay!

The default values for fields if not set are: startTimeOfDay defaults to 00:00:00, the endTimeOfDay default to 23:59:59, and daysOfWeek is default to every day. The startTime default to current time-stamp now, while endTime has not value.

If startTime is before startTimeOfDay, then startTimeOfDay will be used and startTime has no affect. Else if startTime is after startTimeOfDay, then the first fire time for that day will be the next interval after the startTime. For example, if you set startingTimeOfDay=9am, endingTimeOfDay=11am, interval=15 mins, and startTime=9:33am, then the next fire time will be 9:45pm. Note also that if you do not set startTime value, the trigger builder will default to current time, and current time maybe before or after the startTimeOfDay! So be aware how you set your startTime.

This trigger also supports "repeatCount" feature to end the trigger fire time after a certain number of count is reached. Just as the SimpleTrigger, setting repeatCount=0 means trigger will fire once only! Setting any positive count then the trigger will repeat count + 1 times. Unlike SimpleTrigger, the default value of repeatCount of this trigger is set to REPEAT_INDEFINITELY instead of 0 though.

Наследование: AbstractTrigger, IDailyTimeIntervalTrigger, ICoreTrigger
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
AdvanceToNextDayOfWeekIfNecessary DateTimeOffset?
CreateCalendarTime DateTimeOffset
IsSameDay bool

Открытые методы

Метод Описание
ComputeFirstFireTimeUtc ( ICalendar calendar ) : DateTimeOffset?

This method should not be used by the Quartz client.

Called by the scheduler at the time a ITrigger is first added to the scheduler, in order to have the ITrigger compute its first fire time, based on any associated calendar.

After this method has been called, ITrigger.GetNextFireTimeUtc should return a valid answer.

DailyTimeIntervalTriggerImpl ( ) : System

Create a IDailyTimeIntervalTrigger with no settings.

DailyTimeIntervalTriggerImpl ( string name, DateTimeOffset startTimeUtc, DateTimeOffset endTimeUtc, TimeOfDay startTimeOfDayUtc, TimeOfDay endTimeOfDayUtc, IntervalUnit intervalUnit, int repeatInterval ) : System

Create a IDailyTimeIntervalTrigger that will occur at the given time, and repeat at the given interval until the given end time.

DailyTimeIntervalTriggerImpl ( string name, TimeOfDay startTimeOfDayUtc, TimeOfDay endTimeOfDayUtc, IntervalUnit intervalUnit, int repeatInterval ) : System

Create a IDailyTimeIntervalTrigger that will occur immediately, and repeat at the given interval.

DailyTimeIntervalTriggerImpl ( string name, string group, DateTimeOffset startTimeUtc, DateTimeOffset endTimeUtc, TimeOfDay startTimeOfDayUtc, TimeOfDay endTimeOfDayUtc, IntervalUnit intervalUnit, int repeatInterval ) : System

Create a IDailyTimeIntervalTrigger that will occur at the given time, and repeat at the given interval until the given end time.

DailyTimeIntervalTriggerImpl ( string name, string group, TimeOfDay startTimeOfDayUtc, TimeOfDay endTimeOfDayUtc, IntervalUnit intervalUnit, int repeatInterval ) : System

Create a IDailyTimeIntervalTrigger that will occur immediately, and repeat at the given interval.

DailyTimeIntervalTriggerImpl ( string name, string group, string jobName, string jobGroup, DateTimeOffset startTimeUtc, DateTimeOffset endTimeUtc, TimeOfDay startTimeOfDayUtc, TimeOfDay endTimeOfDayUtc, IntervalUnit intervalUnit, int repeatInterval ) : System

Create a IDailyTimeIntervalTrigger that will occur at the given time, fire the identified job and repeat at the given interval until the given end time.

GetFireTimeAfter ( DateTimeOffset afterTime ) : DateTimeOffset?

Returns the next time at which the IDailyTimeIntervalTrigger will fire, after the given time. If the trigger will not fire after the given time, will be returned.

GetMayFireAgain ( ) : bool

Determines whether or not the IDailyTimeIntervalTrigger will occur again.

GetNextFireTimeUtc ( ) : DateTimeOffset?

Returns the next time at which the ITrigger is scheduled to fire. If the trigger will not fire again, will be returned. Note that the time returned can possibly be in the past, if the time that was computed for the trigger to next fire has already arrived, but the scheduler has not yet been able to fire the trigger (which would likely be due to lack of resources e.g. threads).

The value returned is not guaranteed to be valid until after the ITrigger has been added to the scheduler.

GetPreviousFireTimeUtc ( ) : DateTimeOffset?

Returns the previous time at which the ICalendarIntervalTrigger fired. If the trigger has not yet fired, will be returned.

GetScheduleBuilder ( ) : IScheduleBuilder

Get a IScheduleBuilder that is configured to produce a schedule identical to this trigger's schedule.

SetNextFireTimeUtc ( DateTimeOffset value ) : void

Set the next time at which the IDailyTimeIntervalTrigger should fire.

This method should not be invoked by client code.

SetPreviousFireTimeUtc ( DateTimeOffset previousFireTimeUtc ) : void

Set the previous time at which the IDailyTimeIntervalTrigger fired.

This method should not be invoked by client code.

Triggered ( ICalendar calendar ) : void

Called when the scheduler has decided to 'fire' the trigger (execute the associated job), in order to give the trigger a chance to update itself for its next triggering (if any).

UpdateAfterMisfire ( ICalendar cal ) : void

Updates the ICalendarIntervalTrigger's state based on the MisfireInstruction.XXX that was selected when the IDailyTimeIntervalTrigger was created.

If the misfire instruction is set to MisfireInstruction.SmartPolicy, then the following scheme will be used:

  • The instruction will be interpreted as MisfireInstruction.DailyTimeIntervalTrigger.FireOnceNow
UpdateWithNewCalendar ( ICalendar calendar, System.TimeSpan misfireThreshold ) : void

Validate ( ) : void

Validates whether the properties of the IJobDetail are valid for submission into a IScheduler.

Защищенные методы

Метод Описание
ValidateMisfireInstruction ( int misfireInstruction ) : bool

Приватные методы

Метод Описание
AdvanceToNextDayOfWeekIfNecessary ( DateTimeOffset fireTime, bool forceToAdvanceNextDay ) : DateTimeOffset?

Given fireTime time determine if it is on a valid day of week. If so, simply return it unaltered, if not, advance to the next valid week day, and set the time of day to the start time of day.

CreateCalendarTime ( DateTimeOffset dateTime ) : DateTimeOffset
IsSameDay ( DateTimeOffset d1, DateTimeOffset d2 ) : bool

Описание методов

ComputeFirstFireTimeUtc() публичный Метод

This method should not be used by the Quartz client.

Called by the scheduler at the time a ITrigger is first added to the scheduler, in order to have the ITrigger compute its first fire time, based on any associated calendar.

After this method has been called, ITrigger.GetNextFireTimeUtc should return a valid answer.

public ComputeFirstFireTimeUtc ( ICalendar calendar ) : DateTimeOffset?
calendar ICalendar
Результат DateTimeOffset?

DailyTimeIntervalTriggerImpl() публичный Метод

Create a IDailyTimeIntervalTrigger with no settings.
public DailyTimeIntervalTriggerImpl ( ) : System
Результат System

DailyTimeIntervalTriggerImpl() публичный Метод

Create a IDailyTimeIntervalTrigger that will occur at the given time, and repeat at the given interval until the given end time.
public DailyTimeIntervalTriggerImpl ( string name, DateTimeOffset startTimeUtc, DateTimeOffset endTimeUtc, TimeOfDay startTimeOfDayUtc, TimeOfDay endTimeOfDayUtc, IntervalUnit intervalUnit, int repeatInterval ) : System
name string
startTimeUtc DateTimeOffset A set to the time for the to fire.
endTimeUtc DateTimeOffset A set to the time for the to quit repeat firing.
startTimeOfDayUtc TimeOfDay The that the repeating should begin occurring.
endTimeOfDayUtc TimeOfDay The that the repeating should stop occurring.
intervalUnit IntervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are /// , , and .
repeatInterval int The number of milliseconds to pause between the repeat firing.
Результат System

DailyTimeIntervalTriggerImpl() публичный Метод

Create a IDailyTimeIntervalTrigger that will occur immediately, and repeat at the given interval.
public DailyTimeIntervalTriggerImpl ( string name, TimeOfDay startTimeOfDayUtc, TimeOfDay endTimeOfDayUtc, IntervalUnit intervalUnit, int repeatInterval ) : System
name string
startTimeOfDayUtc TimeOfDay The that the repeating should begin occurring.
endTimeOfDayUtc TimeOfDay The that the repeating should stop occurring.
intervalUnit IntervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are /// , , and .
repeatInterval int
Результат System

DailyTimeIntervalTriggerImpl() публичный Метод

Create a IDailyTimeIntervalTrigger that will occur at the given time, and repeat at the given interval until the given end time.
public DailyTimeIntervalTriggerImpl ( string name, string group, DateTimeOffset startTimeUtc, DateTimeOffset endTimeUtc, TimeOfDay startTimeOfDayUtc, TimeOfDay endTimeOfDayUtc, IntervalUnit intervalUnit, int repeatInterval ) : System
name string
group string
startTimeUtc DateTimeOffset A set to the time for the to fire.
endTimeUtc DateTimeOffset A set to the time for the to quit repeat firing.
startTimeOfDayUtc TimeOfDay The that the repeating should begin occurring.
endTimeOfDayUtc TimeOfDay The that the repeating should stop occurring.
intervalUnit IntervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are /// , , and .
repeatInterval int The number of milliseconds to pause between the repeat firing.
Результат System

DailyTimeIntervalTriggerImpl() публичный Метод

Create a IDailyTimeIntervalTrigger that will occur immediately, and repeat at the given interval.
public DailyTimeIntervalTriggerImpl ( string name, string group, TimeOfDay startTimeOfDayUtc, TimeOfDay endTimeOfDayUtc, IntervalUnit intervalUnit, int repeatInterval ) : System
name string
group string
startTimeOfDayUtc TimeOfDay The that the repeating should begin occurring.
endTimeOfDayUtc TimeOfDay The that the repeating should stop occurring.
intervalUnit IntervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are /// , , and .
repeatInterval int
Результат System

DailyTimeIntervalTriggerImpl() публичный Метод

Create a IDailyTimeIntervalTrigger that will occur at the given time, fire the identified job and repeat at the given interval until the given end time.
public DailyTimeIntervalTriggerImpl ( string name, string group, string jobName, string jobGroup, DateTimeOffset startTimeUtc, DateTimeOffset endTimeUtc, TimeOfDay startTimeOfDayUtc, TimeOfDay endTimeOfDayUtc, IntervalUnit intervalUnit, int repeatInterval ) : System
name string
group string
jobName string
jobGroup string
startTimeUtc DateTimeOffset A set to the time for the to fire.
endTimeUtc DateTimeOffset A set to the time for the to quit repeat firing.
startTimeOfDayUtc TimeOfDay The that the repeating should begin occurring.
endTimeOfDayUtc TimeOfDay The that the repeating should stop occurring.
intervalUnit IntervalUnit The repeat interval unit. The only intervals that are valid for this type of trigger are /// , , and .
repeatInterval int The number of milliseconds to pause between the repeat firing.
Результат System

GetFireTimeAfter() публичный Метод

Returns the next time at which the IDailyTimeIntervalTrigger will fire, after the given time. If the trigger will not fire after the given time, will be returned.
public GetFireTimeAfter ( DateTimeOffset afterTime ) : DateTimeOffset?
afterTime DateTimeOffset
Результат DateTimeOffset?

GetMayFireAgain() публичный Метод

Determines whether or not the IDailyTimeIntervalTrigger will occur again.
public GetMayFireAgain ( ) : bool
Результат bool

GetNextFireTimeUtc() публичный Метод

Returns the next time at which the ITrigger is scheduled to fire. If the trigger will not fire again, will be returned. Note that the time returned can possibly be in the past, if the time that was computed for the trigger to next fire has already arrived, but the scheduler has not yet been able to fire the trigger (which would likely be due to lack of resources e.g. threads).
The value returned is not guaranteed to be valid until after the ITrigger has been added to the scheduler.
public GetNextFireTimeUtc ( ) : DateTimeOffset?
Результат DateTimeOffset?

GetPreviousFireTimeUtc() публичный Метод

Returns the previous time at which the ICalendarIntervalTrigger fired. If the trigger has not yet fired, will be returned.
public GetPreviousFireTimeUtc ( ) : DateTimeOffset?
Результат DateTimeOffset?

GetScheduleBuilder() публичный Метод

Get a IScheduleBuilder that is configured to produce a schedule identical to this trigger's schedule.
public GetScheduleBuilder ( ) : IScheduleBuilder
Результат IScheduleBuilder

SetNextFireTimeUtc() публичный Метод

Set the next time at which the IDailyTimeIntervalTrigger should fire.
This method should not be invoked by client code.
public SetNextFireTimeUtc ( DateTimeOffset value ) : void
value DateTimeOffset
Результат void

SetPreviousFireTimeUtc() публичный Метод

Set the previous time at which the IDailyTimeIntervalTrigger fired.
This method should not be invoked by client code.
public SetPreviousFireTimeUtc ( DateTimeOffset previousFireTimeUtc ) : void
previousFireTimeUtc DateTimeOffset
Результат void

Triggered() публичный Метод

Called when the scheduler has decided to 'fire' the trigger (execute the associated job), in order to give the trigger a chance to update itself for its next triggering (if any).
public Triggered ( ICalendar calendar ) : void
calendar ICalendar
Результат void

UpdateAfterMisfire() публичный Метод

Updates the ICalendarIntervalTrigger's state based on the MisfireInstruction.XXX that was selected when the IDailyTimeIntervalTrigger was created.
If the misfire instruction is set to MisfireInstruction.SmartPolicy, then the following scheme will be used:
  • The instruction will be interpreted as MisfireInstruction.DailyTimeIntervalTrigger.FireOnceNow
public UpdateAfterMisfire ( ICalendar cal ) : void
cal ICalendar
Результат void

UpdateWithNewCalendar() публичный Метод

public UpdateWithNewCalendar ( ICalendar calendar, System.TimeSpan misfireThreshold ) : void
calendar ICalendar
misfireThreshold System.TimeSpan
Результат void

Validate() публичный Метод

Validates whether the properties of the IJobDetail are valid for submission into a IScheduler.
public Validate ( ) : void
Результат void

ValidateMisfireInstruction() защищенный Метод

protected ValidateMisfireInstruction ( int misfireInstruction ) : bool
misfireInstruction int
Результат bool