Trigger implementation for cron expressions. Wraps a
CronExpression which parses according to common crontab conventions.
Supports a Quartz day-of-month/week field with an L/# expression. Follows common cron conventions in every other respect, including 0-6 for SUN-SAT (plus 7 for SUN as well). Note that Quartz deviates from the day-of-week convention in cron through 1-7 for SUN-SAT whereas Spring strictly follows cron even in combination with the optional Quartz-specific L/# expressions.
CronExpression
| Modifier and Type | Field and Description |
|---|---|
| private final CronExpression | |
| private final ZoneId |
| Access | Constructor and Description |
|---|---|
| public | CronTrigger(String
a space-separated list of time fields, following cron
expression conventions expression)Build a |
| public | CronTrigger(String
a space-separated list of time fields, following cron
expression conventions expression, TimeZone a time zone in which the trigger times will be generated timeZone)Build a |
| public | CronTrigger(String
a space-separated list of time fields, following cron
expression conventions expression, ZoneId a time zone in which the trigger times will be generated zoneId)Build a |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv Instant | |
| pack-priv Instant | |
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. Indicates whether some other object is "equal to" this one. |
| public static CronTrigger | forFixedExecution(String
a space-separated list of time fields, following cron
expression conventions expression)Create a |
| public static CronTrigger | forLenientExecution(String
a space-separated list of time fields, following cron
expression conventions expression)Create a |
| public String | |
| public int | |
| public Instant | nextExecution(TriggerContext
context object encapsulating last execution times
and last completion time triggerContext)Implements org. Determine the next execution time according to the given trigger context. |
| public static CronTrigger | resumeFixedExecution(String
a space-separated list of time fields, following cron
expression conventions expression, Instant the timestamp to resume from (the last-known
scheduled timestamp), with every trigger in-between immediately firing
to make up for every execution that would have happened in the meantime resumptionTimestamp)Create a |
| public static CronTrigger | resumeLenientExecution(String
a space-separated list of time fields, following cron
expression conventions expression, Instant the timestamp to resume from (the last-known
completion timestamp), with the new trigger calculated from there and
possibly immediately firing (but only once, every subsequent calculation
will start from the completion time of that first resumed trigger) resumptionTimestamp)Create a |
| public String |
| expression | back to summary |
|---|---|
| private final CronExpression expression | |
| zoneId | back to summary |
|---|---|
| private final ZoneId zoneId
| |
| CronTrigger | back to summary |
|---|---|
| public CronTrigger(String expression) Build a This is equivalent to the
| |
| CronTrigger | back to summary |
|---|---|
| public CronTrigger(String expression, TimeZone timeZone) Build a Note that such explicit time zone customization is usually not necessary,
using | |
| CronTrigger | back to summary |
|---|---|
| public CronTrigger(String expression, ZoneId zoneId) Build a Note that such explicit time zone customization is usually not necessary,
using
| |
| determineInitialTimestamp | back to summary |
|---|---|
| pack-priv Instant determineInitialTimestamp(TriggerContext triggerContext) | |
| determineLatestTimestamp | back to summary |
|---|---|
| pack-priv Instant determineLatestTimestamp(TriggerContext triggerContext) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| forFixedExecution | back to summary |
|---|---|
| public static CronTrigger forFixedExecution(String expression) Create a This variant makes up for missed trigger firings if the associated task has taken too long, scheduling a task for every original trigger firing. Such follow-up tasks may execute late but will never be skipped. Immediate versus late execution in case of long-running tasks may be scheduler-dependent but the guarantee to never skip a task is portable.
| |
| forLenientExecution | back to summary |
|---|---|
| public static CronTrigger forLenientExecution(String expression) Create a This variant does not make up for missed trigger firings if the associated task has taken too long. As a consequence, original trigger firings may be skipped if the previous task is still running. This is equivalent to the regular
| |
| getExpression | back to summary |
|---|---|
| public String getExpression() Return the cron pattern that this trigger has been built with. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| nextExecution | back to summary |
|---|---|
| public Instant nextExecution(TriggerContext triggerContext) Implements org. Determine the next execution time according to the given trigger context. Next execution times are calculated based on the completion time of the previous execution; therefore, overlapping executions won't occur.
| |
| resumeFixedExecution | back to summary |
|---|---|
| public static CronTrigger resumeFixedExecution(String expression, Instant resumptionTimestamp) Create a This variant makes up for missed trigger firings if the associated task has taken too long, scheduling a task for every original trigger firing. Such follow-up tasks may execute late but will never be skipped.
| |
| resumeLenientExecution | back to summary |
|---|---|
| public static CronTrigger resumeLenientExecution(String expression, Instant resumptionTimestamp) Create a This variant does not make up for missed trigger firings if the associated task has taken too long. As a consequence, original trigger firings may be skipped if the previous task is still running.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |