Package org.quartz.builders
Class SimpleTriggerBuilder
java.lang.Object
org.quartz.builders.TriggerBuilder
org.quartz.builders.SimpleTriggerBuilder
SimpleScheduleBuilder is a
invalid @link
ScheduleBuilder
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);
-
Method Summary
Modifier and TypeMethodDescriptionSet the time at which the Trigger will no longer fire - even if it's schedule has remaining repeats.Set the identity of the Job which should be fired by the produced Trigger.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.modifiedByCalendar(String calendarName) Set the name of theCalendarthat should be applied to this Trigger's schedule.Specify that the trigger will repeat indefinitely.static SimpleTriggerBuilderCreate a SimpleScheduleBuilder.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.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.usingJobData(JobDataMap newJobDataMap) Set the Trigger'sJobDataMap.withDescription(String description) Set the given (human-meaningful) description of the Trigger.withIdentity(String name) Use the given TriggerKey to identify the Trigger.withIntervalInMilliseconds(long intervalInMillis) Specify a repeat interval in milliseconds.If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOWinstruction.If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNTinstruction.If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNTinstruction.If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNTinstruction.If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNTinstruction.withPriority(int priority) Set the Trigger's priority.withRepeatCount(int repeatCount) Specify a the number of time the trigger will repeat - total number of firings will be this number + 1.Methods inherited from class org.quartz.builders.TriggerBuilder
build, withTriggerImplementation
-
Method Details
-
simpleTriggerBuilder
Create a SimpleScheduleBuilder.- Returns:
- the new SimpleScheduleBuilder
-
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.- Specified by:
instantiatein classTriggerBuilder
-
withIntervalInMilliseconds
Specify a repeat interval in milliseconds.- Parameters:
intervalInMillis- the number of seconds at which the trigger should repeat.- Returns:
- the updated SimpleScheduleBuilder
- See Also:
-
withRepeatCount
Specify a the number of time the trigger will repeat - total number of firings will be this number + 1.- Parameters:
repeatCount- the number of seconds at which the trigger should repeat.- Returns:
- the updated SimpleScheduleBuilder
- See Also:
-
repeatForever
Specify that the trigger will repeat indefinitely.- Returns:
- the updated SimpleScheduleBuilder
- See Also:
-
withMisfireHandlingInstructionFireNow
If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOWinstruction.- Returns:
- the updated SimpleScheduleBuilder
- See Also:
-
withMisfireHandlingInstructionNextWithExistingCount
If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNTinstruction.- Returns:
- the updated SimpleScheduleBuilder
- See Also:
-
withMisfireHandlingInstructionNextWithRemainingCount
If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNTinstruction.- Returns:
- the updated SimpleScheduleBuilder
- See Also:
-
withMisfireHandlingInstructionNowWithExistingCount
If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNTinstruction.- Returns:
- the updated SimpleScheduleBuilder
- See Also:
-
withMisfireHandlingInstructionNowWithRemainingCount
If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNTinstruction.- Returns:
- the updated SimpleScheduleBuilder
- See Also:
-
withIdentity
Description copied from class:TriggerBuilderUse the given TriggerKey to identify the Trigger.If none of the 'withIdentity' methods are set on the TriggerBuilder, then a random, unique TriggerKey will be generated.
- Overrides:
withIdentityin classTriggerBuilder- Parameters:
name- the TriggerKey for the Trigger to be built- Returns:
- the updated TriggerBuilder
-
withDescription
Description copied from class:TriggerBuilderSet the given (human-meaningful) description of the Trigger.- Overrides:
withDescriptionin classTriggerBuilder- Parameters:
description- the description for the Trigger- Returns:
- the updated TriggerBuilder
-
withPriority
Description copied from class:TriggerBuilderSet the Trigger's priority. When more than one Trigger have the same fire time, the scheduler will fire the one with the highest priority first.- Overrides:
withPriorityin classTriggerBuilder- Parameters:
priority- the priority for the Trigger- Returns:
- the updated TriggerBuilder
-
modifiedByCalendar
Description copied from class:TriggerBuilderSet the name of theCalendarthat should be applied to this Trigger's schedule.- Overrides:
modifiedByCalendarin classTriggerBuilder- Parameters:
calendarName- the name of the Calendar to reference.- Returns:
- the updated TriggerBuilder
-
startNow
Description copied from class:TriggerBuilderSet 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.- Overrides:
startNowin classTriggerBuilder- Returns:
- the updated TriggerBuilder
-
startAt
Description copied from class:TriggerBuilderSet 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. However the Trigger will NOT fire before this time, regardless of the Trigger's schedule.- Overrides:
startAtin classTriggerBuilder- Parameters:
startTime- the start time for the Trigger.- Returns:
- the updated TriggerBuilder
-
endAt
Description copied from class:TriggerBuilderSet the time at which the Trigger will no longer fire - even if it's schedule has remaining repeats.- Overrides:
endAtin classTriggerBuilder- Parameters:
endTime- the end time for the Trigger. If null, the end time is indefinite.- Returns:
- the updated TriggerBuilder
-
forJob
Description copied from class:TriggerBuilderSet the identity of the Job which should be fired by the produced Trigger.- Overrides:
forJobin classTriggerBuilder- Parameters:
jobName- the identity of the Job to fire.- Returns:
- the updated TriggerBuilder
-
usingJobData
Description copied from class:TriggerBuilderSet the Trigger'sJobDataMap.- Overrides:
usingJobDatain classTriggerBuilder- Returns:
- the updated TriggerBuilder
-