public class CronTrigger extends Object implements Trigger
Trigger
implementation for cron expressions.
Wraps a CronExpression
.CronExpression
Constructor and Description |
---|
CronTrigger(String expression)
Build a
CronTrigger from the pattern provided in the default time zone. |
CronTrigger(String expression,
TimeZone timeZone)
Build a
CronTrigger from the pattern provided in the given time zone. |
CronTrigger(String expression,
ZoneId zoneId)
Build a
CronTrigger from the pattern provided in the given time zone. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
String |
getExpression()
Return the cron pattern that this trigger has been built with.
|
int |
hashCode() |
Date |
nextExecutionTime(TriggerContext triggerContext)
Determine the next execution time according to the given trigger context.
|
String |
toString() |
public CronTrigger(String expression)
CronTrigger
from the pattern provided in the default time zone.expression
- a space-separated list of time fields, following cron
expression conventionspublic CronTrigger(String expression, TimeZone timeZone)
CronTrigger
from the pattern provided in the given time zone.expression
- a space-separated list of time fields, following cron
expression conventionstimeZone
- a time zone in which the trigger times will be generatedpublic CronTrigger(String expression, ZoneId zoneId)
CronTrigger
from the pattern provided in the given time zone.expression
- a space-separated list of time fields, following cron
expression conventionszoneId
- a time zone in which the trigger times will be generatedCronExpression.parse(String)
public String getExpression()
public Date nextExecutionTime(TriggerContext triggerContext)
Next execution times are calculated based on the completion time of the previous execution; therefore, overlapping executions won't occur.
nextExecutionTime
in interface Trigger
triggerContext
- context object encapsulating last execution times
and last completion timenull
if the trigger won't fire anymore