public class CronTriggerBuilder extends TriggerBuilder
CronScheduleBuilder is a ScheduleBuilder that defines CronExpression-based schedules for Triggers.
Quartz provides a builder-style API for constructing scheduling-related entities via a Domain-Specific Language (DSL). The DSL can best be utilized
through the usage of static imports of the methods on the classes TriggerBuilder, JobBuilder, DateBuilder,
JobKey, TriggerKey and the various ScheduleBuilder implementations.
Client code can then use the DSL to write code such as this:
JobDetail job = newJob(MyJob.class).withIdentity("myJob").build();
Trigger trigger = newTrigger().withIdentity(triggerKey("myTrigger", "myTriggerGroup"))
.withSchedule(simpleSchedule().withIntervalInHours(1).repeatForever()).startAt(futureDate(10, MINUTES)).build();
scheduler.scheduleJob(job, trigger);
| Modifier and Type | Method and Description |
|---|---|
static CronTriggerBuilder |
cronTriggerBuilder(String cronExpression)
Create a CronScheduleBuilder with the given cron-expression.
|
CronTriggerBuilder |
endAt(Date endTime)
Set the time at which the Trigger will no longer fire - even if it's schedule has remaining repeats.
|
CronTriggerBuilder |
forJob(String jobName)
Set the identity of the Job which should be fired by the produced Trigger.
|
OperableTrigger |
instantiate()
Build the actual Trigger -- NOT intended to be invoked by end users, but will rather be invoked by a TriggerBuilder which this ScheduleBuilder is
given to.
|
CronTriggerBuilder |
inTimeZone(TimeZone tz)
The
TimeZone in which to base the schedule. |
CronTriggerBuilder |
modifiedByCalendar(String calendarName)
Set the name of the
Calendar that should be applied to this Trigger's schedule. |
CronTriggerBuilder |
startAt(Date startTime)
Set the time the Trigger should start at - the trigger may or may not fire at this time - depending upon the schedule configured for the Trigger.
|
CronTriggerBuilder |
startNow()
Set the time the Trigger should start at to the current moment - the trigger may or may not fire at this time - depending upon the schedule
configured for the Trigger.
|
CronTriggerBuilder |
usingJobData(JobDataMap newJobDataMap)
Set the Trigger's
JobDataMap. |
CronTriggerBuilder |
withDescription(String description)
Set the given (human-meaningful) description of the Trigger.
|
CronTriggerBuilder |
withIdentity(String name)
Use the given TriggerKey to identify the Trigger.
|
CronTriggerBuilder |
withMisfireHandlingInstructionDoNothing()
If the Trigger misfires, use the
CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING instruction. |
CronTriggerBuilder |
withMisfireHandlingInstructionFireAndProceed()
If the Trigger misfires, use the
CronTrigger.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW instruction. |
CronTriggerBuilder |
withPriority(int priority)
Set the Trigger's priority.
|
build, withTriggerImplementationpublic static CronTriggerBuilder cronTriggerBuilder(String cronExpression) throws ParseException
cronExpression - the cron expression to base the schedule on.ParseExceptionCronExpressionpublic OperableTrigger instantiate()
instantiate in class TriggerBuilderpublic CronTriggerBuilder inTimeZone(TimeZone tz)
TimeZone in which to base the schedule.tz - the time-zone for the schedule.CronExpression.getTimeZone()public CronTriggerBuilder withMisfireHandlingInstructionDoNothing()
CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING instruction.CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHINGpublic CronTriggerBuilder withMisfireHandlingInstructionFireAndProceed()
CronTrigger.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW instruction.CronTrigger.MISFIRE_INSTRUCTION_FIRE_ONCE_NOWpublic CronTriggerBuilder withIdentity(String name)
TriggerBuilderIf none of the 'withIdentity' methods are set on the TriggerBuilder, then a random, unique TriggerKey will be generated.
withIdentity in class TriggerBuildername - the TriggerKey for the Trigger to be builtpublic CronTriggerBuilder withDescription(String description)
TriggerBuilderwithDescription in class TriggerBuilderdescription - the description for the Triggerpublic CronTriggerBuilder withPriority(int priority)
TriggerBuilderwithPriority in class TriggerBuilderpriority - the priority for the Triggerpublic CronTriggerBuilder modifiedByCalendar(String calendarName)
TriggerBuilderCalendar that should be applied to this Trigger's schedule.modifiedByCalendar in class TriggerBuildercalendarName - the name of the Calendar to reference.public CronTriggerBuilder startNow()
TriggerBuilderstartNow in class TriggerBuilderpublic CronTriggerBuilder startAt(Date startTime)
TriggerBuilderstartAt in class TriggerBuilderstartTime - the start time for the Trigger.public CronTriggerBuilder endAt(Date endTime)
TriggerBuilderendAt in class TriggerBuilderendTime - the end time for the Trigger. If null, the end time is indefinite.public CronTriggerBuilder forJob(String jobName)
TriggerBuilderforJob in class TriggerBuilderjobName - the identity of the Job to fire.public CronTriggerBuilder usingJobData(JobDataMap newJobDataMap)
TriggerBuilderJobDataMap.usingJobData in class TriggerBuilderCopyright © 2011–2017 Knowm Inc.. All rights reserved.