CronTriggerImpl Class

Quartz.NET 3.0 API Documentation
A concrete ITrigger that is used to fire a IJobDetail at given moments in time, defined with Unix 'cron-like' definitions.
Inheritance Hierarchy

SystemObject
  Quartz.Impl.TriggersAbstractTrigger
    Quartz.Impl.TriggersCronTriggerImpl

Namespace:  Quartz.Impl.Triggers
Assembly:  Quartz (in Quartz.dll) Version: 3.0.0
Syntax

C#
[SerializableAttribute]
public class CronTriggerImpl : AbstractTrigger, 
	ICronTrigger, ITrigger, IComparable<ITrigger>

The CronTriggerImpl type exposes the following members.

Constructors

  NameDescription
Public methodCronTriggerImpl
Create a CronTriggerImpl with no settings.
Public methodCronTriggerImpl(String)
Create a CronTriggerImpl with the given name and default group.
Public methodCronTriggerImpl(String, String)
Create a CronTriggerImpl with the given name and group.
Public methodCronTriggerImpl(String, String, String)
Create a CronTriggerImpl with the given name, group and expression.
Public methodCronTriggerImpl(String, String, String, String)
Create a CronTriggerImpl with the given name and group, and associated with the identified IJobDetail.
Public methodCronTriggerImpl(String, String, String, String, String)
Create a ICronTrigger with the given name and group, associated with the identified IJobDetail, and with the given "cron" expression.
Public methodCronTriggerImpl(String, String, String, String, String, TimeZoneInfo)
Create a ICronTrigger with the given name and group, associated with the identified IJobDetail, and with the given "cron" expression resolved with respect to the TimeZone.
Public methodCronTriggerImpl(String, String, String, String, DateTimeOffset, NullableDateTimeOffset, String)
Create a ICronTrigger that will occur at the given time, until the given end time.

If null, the start-time will also be set to the current time, the time zone will be set to the system's default.

Public methodCronTriggerImpl(String, String, String, String, DateTimeOffset, NullableDateTimeOffset, String, TimeZoneInfo)
Create a CronTriggerImpl with fire time dictated by the cronExpression resolved with respect to the specified timeZone occurring from the startTimeUtc until the given endTime.
Top
Properties

  NameDescription
Public propertyCalendarName
Get or set the ICalendar with the given name with this Trigger. Use when setting to dis-associate a Calendar.
(Inherited from AbstractTrigger.)
Public propertyCronExpression
Set the CronExpression to the given one. The TimeZone on the passed-in CronExpression over-rides any that was already set on the Trigger.
Public propertyCronExpressionString
Gets or sets the cron expression string.
Public propertyDescription
Get or set the description given to the ITrigger instance by its creator (if any).
(Inherited from AbstractTrigger.)
Public propertyEndTimeUtc
Get or sets the time at which the CronTrigger should quit repeating - even if repeatCount isn't yet satisfied.
(Overrides AbstractTriggerEndTimeUtc.)
Public propertyFinalFireTimeUtc
Returns the last UTC time at which the ITrigger will fire, if the Trigger will repeat indefinitely, null will be returned.

Note that the return time *may* be in the past.

(Overrides AbstractTriggerFinalFireTimeUtc.)
Public propertyFireInstanceId
This method should not be used by the Quartz client.
(Inherited from AbstractTrigger.)
Public propertyFullJobName
Returns the 'full name' of the IJob that the ITrigger points to, in the format "group.name".
(Inherited from AbstractTrigger.)
Public propertyFullName
Returns the 'full name' of the ITrigger in the format "group.name".
(Inherited from AbstractTrigger.)
Public propertyGroup
Get the group of this ITrigger. If , Scheduler.DefaultGroup will be used.
(Inherited from AbstractTrigger.)
Public propertyHasAdditionalProperties
Gets a value indicating whether this instance has additional properties that should be considered when for example saving to database.
(Inherited from AbstractTrigger.)
Public propertyHasMillisecondPrecision
Tells whether this Trigger instance can handle events in millisecond precision.
(Overrides AbstractTriggerHasMillisecondPrecision.)
Public propertyJobDataMap
Get or set the JobDataMap that is associated with the ITrigger.

Changes made to this map during job execution are not re-persisted, and in fact typically result in an illegal state.

(Inherited from AbstractTrigger.)
Public propertyJobGroup
Gets or sets the name of the associated IJobDetail's group. If set with , Scheduler.DefaultGroup will be used.
(Inherited from AbstractTrigger.)
Public propertyJobKey (Inherited from AbstractTrigger.)
Public propertyJobName
Get or set the name of the associated IJobDetail.
(Inherited from AbstractTrigger.)
Public propertyKey
Gets the key.
(Inherited from AbstractTrigger.)
Public propertyMisfireInstruction
Get or set the instruction the IScheduler should be given for handling misfire situations for this ITrigger- the concrete ITrigger type that you are using will have defined a set of additional MISFIRE_INSTRUCTION_XXX constants that may be passed to this method.

If not explicitly set, the default value is InstructionNotSet.

(Inherited from AbstractTrigger.)
Public propertyName
Get or sets the name of this ITrigger.
(Inherited from AbstractTrigger.)
Public propertyPriority
The priority of a ITrigger acts as a tie breaker such that if two ITriggers 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.
(Inherited from AbstractTrigger.)
Public propertyStartTimeUtc
Returns the date/time on which the trigger may begin firing. This defines the initial boundary for trigger firings the trigger will not fire prior to this date and time.
(Overrides AbstractTriggerStartTimeUtc.)
Public propertyTimeZone
Sets the time zone for which the CronExpressionString of this ICronTrigger will be resolved.
Top
Methods

  NameDescription
Public methodClone
Clones this instance.
(Overrides AbstractTriggerClone.)
Public methodCompareTo
Compare the next fire time of this ITrigger to that of another by comparing their keys, or in other words, sorts them according to the natural (i.e. alphabetical) order of their keys.
(Inherited from AbstractTrigger.)
Public methodComputeFirstFireTimeUtc
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, GetNextFireTimeUtc should return a valid answer.

(Overrides AbstractTriggerComputeFirstFireTimeUtc(ICalendar).)
Public methodEquals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from AbstractTrigger.)
Public methodEquals(AbstractTrigger)
Trigger equality is based upon the equality of the TriggerKey.
(Inherited from AbstractTrigger.)
Public methodExecutionComplete
This method should not be used by the Quartz client.
(Inherited from AbstractTrigger.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetExpressionSummary
Gets the expression summary.
Public methodGetFireTimeAfter
Returns the next time at which the ITrigger will fire, after the given time. If the trigger will not fire after the given time, will be returned.
(Overrides AbstractTriggerGetFireTimeAfter(NullableDateTimeOffset).)
Public methodGetHashCode
Serves as a hash function for a particular type. GetHashCode is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from AbstractTrigger.)
Public methodGetMayFireAgain
Used by the IScheduler to determine whether or not it is possible for this ITrigger to fire again.

If the returned value is then the IScheduler may remove the ITrigger from the IJobStore.

(Overrides AbstractTriggerGetMayFireAgain.)
Public methodGetNextFireTimeUtc
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).
(Overrides AbstractTriggerGetNextFireTimeUtc.)
Public methodGetPreviousFireTimeUtc
Returns the previous time at which the ITrigger fired. If the trigger has not yet fired, will be returned.
(Overrides AbstractTriggerGetPreviousFireTimeUtc.)
Public methodGetScheduleBuilder (Overrides AbstractTriggerGetScheduleBuilder.)
Protected methodGetTimeAfter
Gets the next time to fire after the given time.
Protected methodGetTimeBefore
NOT YET IMPLEMENTED: Returns the time before the given time that this ICronTrigger will fire.
Public methodGetTriggerBuilder (Inherited from AbstractTrigger.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSetNextFireTimeUtc
Sets the next fire time.

This method should not be invoked by client code.

(Overrides AbstractTriggerSetNextFireTimeUtc(NullableDateTimeOffset).)
Public methodSetPreviousFireTimeUtc
Sets the previous fire time.

This method should not be invoked by client code.

(Overrides AbstractTriggerSetPreviousFireTimeUtc(NullableDateTimeOffset).)
Public methodToString
Return a simple string representation of this object.
(Inherited from AbstractTrigger.)
Public methodTriggered
Called when the IScheduler has decided to 'fire' the trigger (Execute the associated IJob), in order to give the ITrigger a chance to update itself for its next triggering (if any).
(Overrides AbstractTriggerTriggered(ICalendar).)
Public methodUpdateAfterMisfire
This method should not be used by the Quartz client.

To be implemented by the concrete classes that extend this class.

The implementation should update the ITrigger's state based on the MISFIRE_INSTRUCTION_XXX that was selected when the ITrigger was created.

(Overrides AbstractTriggerUpdateAfterMisfire(ICalendar).)
Public methodUpdateWithNewCalendar
Updates the trigger with new calendar.
(Overrides AbstractTriggerUpdateWithNewCalendar(ICalendar, TimeSpan).)
Public methodValidate
Validates whether the properties of the IJobDetail are valid for submission into a IScheduler.
(Inherited from AbstractTrigger.)
Protected methodValidateMisfireInstruction
Validates the misfire instruction.
(Overrides AbstractTriggerValidateMisfireInstruction(Int32).)
Public methodWillFireOn(DateTimeOffset)

Determines whether the date and (optionally) time of the given Calendar instance falls on a scheduled fire-time of this trigger.

Equivalent to calling WillFireOn(DateTimeOffset, Boolean).

Public methodWillFireOn(DateTimeOffset, Boolean)
Determines whether the date and (optionally) time of the given Calendar instance falls on a scheduled fire-time of this trigger.

Note that the value returned is NOT validated against the related ICalendar (if any).

Top
Fields

  NameDescription
Protected fieldStatic memberYearToGiveupSchedulingAt
Top
Remarks

For those unfamiliar with "cron", this means being able to create a firing schedule such as: "At 8:00am every Monday through Friday" or "At 1:30am every last Friday of the month".

The format of a "Cron-Expression" string is documented on the CronExpression class.

Here are some full examples:
ExpressionMeaning
"0 0 12 * * ?"" />Fire at 12pm (noon) every day" />
"0 15 10 ? * *"" />Fire at 10:15am every day" />
"0 15 10 * * ?"" />Fire at 10:15am every day" />
"0 15 10 * * ? *"" />Fire at 10:15am every day" />
"0 15 10 * * ? 2005"" />Fire at 10:15am every day during the year 2005" />
"0 * 14 * * ?"" />Fire every minute starting at 2pm and ending at 2:59pm, every day" />
"0 0/5 14 * * ?"" />Fire every 5 minutes starting at 2pm and ending at 2:55pm, every day" />
"0 0/5 14,18 * * ?"" />Fire every 5 minutes starting at 2pm and ending at 2:55pm, AND fire every 5 minutes starting at 6pm and ending at 6:55pm, every day" />
"0 0-5 14 * * ?"" />Fire every minute starting at 2pm and ending at 2:05pm, every day" />
"0 10,44 14 ? 3 WED"" />Fire at 2:10pm and at 2:44pm every Wednesday in the month of March." />
"0 15 10 ? * MON-FRI"" />Fire at 10:15am every Monday, Tuesday, Wednesday, Thursday and Friday" />
"0 15 10 15 * ?"" />Fire at 10:15am on the 15th day of every month" />
"0 15 10 L * ?"" />Fire at 10:15am on the last day of every month" />
"0 15 10 ? * 6L"" />Fire at 10:15am on the last Friday of every month" />
"0 15 10 ? * 6L"" />Fire at 10:15am on the last Friday of every month" />
"0 15 10 ? * 6L 2002-2005"" />Fire at 10:15am on every last Friday of every month during the years 2002, 2003, 2004 and 2005" />
"0 15 10 ? * 6#3"" />Fire at 10:15am on the third Friday of every month" />

Pay attention to the effects of '?' and '*' in the day-of-week and day-of-month fields!

NOTES:

  • Support for specifying both a day-of-week and a day-of-month value is not complete (you'll need to use the '?' character in on of these fields).
  • Be careful when setting fire times between mid-night and 1:00 AM - "daylight savings" can cause a skip or a repeat depending on whether the time moves back or jumps forward.

See Also

Reference