public class SimpleTriggerBuilder extends TriggerBuilder
SimpleScheduleBuilder is a ScheduleBuilder that defines strict/literal interval-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 |
|---|---|
SimpleTriggerBuilder |
endAt(Date endTime)
Set the time at which the Trigger will no longer fire - even if it's schedule has remaining repeats.
|
SimpleTriggerBuilder |
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.
|
SimpleTriggerBuilder |
modifiedByCalendar(String calendarName)
Set the name of the
Calendar that should be applied to this Trigger's schedule. |
SimpleTriggerBuilder |
repeatForever()
Specify that the trigger will repeat indefinitely.
|
static SimpleTriggerBuilder |
simpleTriggerBuilder()
Create a SimpleScheduleBuilder.
|
SimpleTriggerBuilder |
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.
|
SimpleTriggerBuilder |
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.
|
SimpleTriggerBuilder |
usingJobData(JobDataMap newJobDataMap)
Set the Trigger's
JobDataMap. |
SimpleTriggerBuilder |
withDescription(String description)
Set the given (human-meaningful) description of the Trigger.
|
SimpleTriggerBuilder |
withIdentity(String name)
Use the given TriggerKey to identify the Trigger.
|
SimpleTriggerBuilder |
withIntervalInMilliseconds(long intervalInMillis)
Specify a repeat interval in milliseconds.
|
SimpleTriggerBuilder |
withMisfireHandlingInstructionFireNow()
If the Trigger misfires, use the
SimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOW instruction. |
SimpleTriggerBuilder |
withMisfireHandlingInstructionNextWithExistingCount()
If the Trigger misfires, use the
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT instruction. |
SimpleTriggerBuilder |
withMisfireHandlingInstructionNextWithRemainingCount()
If the Trigger misfires, use the
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT instruction. |
SimpleTriggerBuilder |
withMisfireHandlingInstructionNowWithExistingCount()
If the Trigger misfires, use the
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT instruction. |
SimpleTriggerBuilder |
withMisfireHandlingInstructionNowWithRemainingCount()
If the Trigger misfires, use the
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT instruction. |
SimpleTriggerBuilder |
withPriority(int priority)
Set the Trigger's priority.
|
SimpleTriggerBuilder |
withRepeatCount(int repeatCount)
Specify a the number of time the trigger will repeat - total number of firings will be this number + 1.
|
build, withTriggerImplementationpublic static SimpleTriggerBuilder simpleTriggerBuilder()
public OperableTrigger instantiate()
instantiate in class TriggerBuilderpublic SimpleTriggerBuilder withIntervalInMilliseconds(long intervalInMillis)
intervalInMillis - the number of seconds at which the trigger should repeat.SimpleTrigger.getRepeatInterval(),
withRepeatCount(int)public SimpleTriggerBuilder withRepeatCount(int repeatCount)
repeatCount - the number of seconds at which the trigger should repeat.SimpleTrigger.getRepeatCount(),
repeatForever()public SimpleTriggerBuilder repeatForever()
SimpleTrigger.getRepeatCount(),
SimpleTrigger.REPEAT_INDEFINITELY,
withIntervalInMilliseconds(long)public SimpleTriggerBuilder withMisfireHandlingInstructionFireNow()
SimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOW instruction.SimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOWpublic SimpleTriggerBuilder withMisfireHandlingInstructionNextWithExistingCount()
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT instruction.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNTpublic SimpleTriggerBuilder withMisfireHandlingInstructionNextWithRemainingCount()
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT instruction.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNTpublic SimpleTriggerBuilder withMisfireHandlingInstructionNowWithExistingCount()
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT instruction.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNTpublic SimpleTriggerBuilder withMisfireHandlingInstructionNowWithRemainingCount()
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT instruction.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNTpublic SimpleTriggerBuilder 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 SimpleTriggerBuilder withDescription(String description)
TriggerBuilderwithDescription in class TriggerBuilderdescription - the description for the Triggerpublic SimpleTriggerBuilder withPriority(int priority)
TriggerBuilderwithPriority in class TriggerBuilderpriority - the priority for the Triggerpublic SimpleTriggerBuilder 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 SimpleTriggerBuilder startNow()
TriggerBuilderstartNow in class TriggerBuilderpublic SimpleTriggerBuilder startAt(Date startTime)
TriggerBuilderstartAt in class TriggerBuilderstartTime - the start time for the Trigger.public SimpleTriggerBuilder endAt(Date endTime)
TriggerBuilderendAt in class TriggerBuilderendTime - the end time for the Trigger. If null, the end time is indefinite.public SimpleTriggerBuilder forJob(String jobName)
TriggerBuilderforJob in class TriggerBuilderjobName - the identity of the Job to fire.public SimpleTriggerBuilder usingJobData(JobDataMap newJobDataMap)
TriggerBuilderJobDataMap.usingJobData in class TriggerBuilderCopyright © 2011–2017 Knowm Inc.. All rights reserved.