Package org.quartz.builders
Class SimpleTriggerBuilder
java.lang.Object
org.quartz.builders.TriggerBuilder
org.quartz.builders.SimpleTriggerBuilder
SimpleScheduleBuilder
is a
invalid @link
ScheduleBuilder
Trigger
s.
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 theCalendar
that should be applied to this Trigger's schedule.Specify that the trigger will repeat indefinitely.static SimpleTriggerBuilder
Create 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_NOW
instruction.If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT
instruction.If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT
instruction.If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT
instruction.If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT
instruction.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:
instantiate
in 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_NOW
instruction.- Returns:
- the updated SimpleScheduleBuilder
- See Also:
-
withMisfireHandlingInstructionNextWithExistingCount
If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT
instruction.- Returns:
- the updated SimpleScheduleBuilder
- See Also:
-
withMisfireHandlingInstructionNextWithRemainingCount
If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT
instruction.- Returns:
- the updated SimpleScheduleBuilder
- See Also:
-
withMisfireHandlingInstructionNowWithExistingCount
If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT
instruction.- Returns:
- the updated SimpleScheduleBuilder
- See Also:
-
withMisfireHandlingInstructionNowWithRemainingCount
If the Trigger misfires, use theSimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT
instruction.- Returns:
- the updated SimpleScheduleBuilder
- See Also:
-
withIdentity
Description copied from class:TriggerBuilder
Use 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:
withIdentity
in classTriggerBuilder
- Parameters:
name
- the TriggerKey for the Trigger to be built- Returns:
- the updated TriggerBuilder
-
withDescription
Description copied from class:TriggerBuilder
Set the given (human-meaningful) description of the Trigger.- Overrides:
withDescription
in classTriggerBuilder
- Parameters:
description
- the description for the Trigger- Returns:
- the updated TriggerBuilder
-
withPriority
Description copied from class:TriggerBuilder
Set 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:
withPriority
in classTriggerBuilder
- Parameters:
priority
- the priority for the Trigger- Returns:
- the updated TriggerBuilder
-
modifiedByCalendar
Description copied from class:TriggerBuilder
Set the name of theCalendar
that should be applied to this Trigger's schedule.- Overrides:
modifiedByCalendar
in classTriggerBuilder
- Parameters:
calendarName
- the name of the Calendar to reference.- Returns:
- the updated TriggerBuilder
-
startNow
Description copied from class:TriggerBuilder
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.- Overrides:
startNow
in classTriggerBuilder
- Returns:
- the updated TriggerBuilder
-
startAt
Description copied from class:TriggerBuilder
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. However the Trigger will NOT fire before this time, regardless of the Trigger's schedule.- Overrides:
startAt
in classTriggerBuilder
- Parameters:
startTime
- the start time for the Trigger.- Returns:
- the updated TriggerBuilder
-
endAt
Description copied from class:TriggerBuilder
Set the time at which the Trigger will no longer fire - even if it's schedule has remaining repeats.- Overrides:
endAt
in 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:TriggerBuilder
Set the identity of the Job which should be fired by the produced Trigger.- Overrides:
forJob
in classTriggerBuilder
- Parameters:
jobName
- the identity of the Job to fire.- Returns:
- the updated TriggerBuilder
-
usingJobData
Description copied from class:TriggerBuilder
Set the Trigger'sJobDataMap
.- Overrides:
usingJobData
in classTriggerBuilder
- Returns:
- the updated TriggerBuilder
-