public class SimpleScheduleBuilder extends Object implements IScheduleBuilder<SimpleTrigger>
SimpleScheduleBuilder is a IScheduleBuilder 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 | Constructor and Description |
|---|---|
protected |
SimpleScheduleBuilder() |
| Modifier and Type | Method and Description |
|---|---|
SimpleTrigger |
build()
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.
|
SimpleScheduleBuilder |
repeatForever()
Specify that the trigger will repeat indefinitely.
|
static SimpleScheduleBuilder |
repeatHourlyForever()
Create a SimpleScheduleBuilder set to repeat forever with a 1 hour
interval.
|
static SimpleScheduleBuilder |
repeatHourlyForever(int nHours)
Create a SimpleScheduleBuilder set to repeat forever with an interval of
the given number of hours.
|
static SimpleScheduleBuilder |
repeatHourlyForTotalCount(int nCount)
Create a SimpleScheduleBuilder set to repeat the given number of times - 1
with a 1 hour interval.
|
static SimpleScheduleBuilder |
repeatHourlyForTotalCount(int nCount,
int nHours)
Create a SimpleScheduleBuilder set to repeat the given number of times - 1
with an interval of the given number of hours.
|
static SimpleScheduleBuilder |
repeatMinutelyForever()
Create a SimpleScheduleBuilder set to repeat forever with a 1 minute
interval.
|
static SimpleScheduleBuilder |
repeatMinutelyForever(int minutes)
Create a SimpleScheduleBuilder set to repeat forever with an interval of
the given number of minutes.
|
static SimpleScheduleBuilder |
repeatMinutelyForTotalCount(int nCount)
Create a SimpleScheduleBuilder set to repeat the given number of times - 1
with a 1 minute interval.
|
static SimpleScheduleBuilder |
repeatMinutelyForTotalCount(int nCount,
int nMinutes)
Create a SimpleScheduleBuilder set to repeat the given number of times - 1
with an interval of the given number of minutes.
|
static SimpleScheduleBuilder |
repeatSecondlyForever()
Create a SimpleScheduleBuilder set to repeat forever with a 1 second
interval.
|
static SimpleScheduleBuilder |
repeatSecondlyForever(int seconds)
Create a SimpleScheduleBuilder set to repeat forever with an interval of
the given number of seconds.
|
static SimpleScheduleBuilder |
repeatSecondlyForTotalCount(int nCount)
Create a SimpleScheduleBuilder set to repeat the given number of times - 1
with a 1 second interval.
|
static SimpleScheduleBuilder |
repeatSecondlyForTotalCount(int nCount,
int nSeconds)
Create a SimpleScheduleBuilder set to repeat the given number of times - 1
with an interval of the given number of seconds.
|
static SimpleScheduleBuilder |
simpleSchedule()
Create a SimpleScheduleBuilder.
|
SimpleScheduleBuilder |
withIntervalInHours(int intervalInHours)
Specify a repeat interval in minutes - which will then be multiplied by 60
* 60 * 1000 to produce milliseconds.
|
SimpleScheduleBuilder |
withIntervalInMilliseconds(long nIntervalInMillis)
Specify a repeat interval in milliseconds.
|
SimpleScheduleBuilder |
withIntervalInMinutes(int nIntervalInMinutes)
Specify a repeat interval in minutes - which will then be multiplied by 60
* 1000 to produce milliseconds.
|
SimpleScheduleBuilder |
withIntervalInSeconds(int nIntervalInSeconds)
Specify a repeat interval in seconds - which will then be multiplied by
1000 to produce milliseconds.
|
SimpleScheduleBuilder |
withMisfireHandlingInstructionFireNow()
If the Trigger misfires, use the
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW instruction. |
SimpleScheduleBuilder |
withMisfireHandlingInstructionIgnoreMisfires()
If the Trigger misfires, use the
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY
instruction. |
SimpleScheduleBuilder |
withMisfireHandlingInstructionNextWithExistingCount()
If the Trigger misfires, use the
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT
instruction. |
SimpleScheduleBuilder |
withMisfireHandlingInstructionNextWithRemainingCount()
If the Trigger misfires, use the
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT
instruction. |
SimpleScheduleBuilder |
withMisfireHandlingInstructionNowWithExistingCount()
If the Trigger misfires, use the
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT
instruction. |
SimpleScheduleBuilder |
withMisfireHandlingInstructionNowWithRemainingCount()
If the Trigger misfires, use the
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT
instruction. |
SimpleScheduleBuilder |
withRepeatCount(int triggerRepeatCount)
Specify a the number of time the trigger will repeat - total number of
firings will be this number + 1.
|
@Nonnull public static SimpleScheduleBuilder simpleSchedule()
@Nonnull public static SimpleScheduleBuilder repeatMinutelyForever()
@Nonnull public static SimpleScheduleBuilder repeatMinutelyForever(int minutes)
@Nonnull public static SimpleScheduleBuilder repeatSecondlyForever()
@Nonnull public static SimpleScheduleBuilder repeatSecondlyForever(int seconds)
@Nonnull public static SimpleScheduleBuilder repeatHourlyForever()
@Nonnull public static SimpleScheduleBuilder repeatHourlyForever(int nHours)
@Nonnull public static SimpleScheduleBuilder repeatMinutelyForTotalCount(int nCount)
Note: Total count = 1 (at start time) + repeat count
@Nonnull public static SimpleScheduleBuilder repeatMinutelyForTotalCount(int nCount, int nMinutes)
Note: Total count = 1 (at start time) + repeat count
@Nonnull public static SimpleScheduleBuilder repeatSecondlyForTotalCount(int nCount)
Note: Total count = 1 (at start time) + repeat count
@Nonnull public static SimpleScheduleBuilder repeatSecondlyForTotalCount(int nCount, int nSeconds)
Note: Total count = 1 (at start time) + repeat count
@Nonnull public static SimpleScheduleBuilder repeatHourlyForTotalCount(int nCount)
Note: Total count = 1 (at start time) + repeat count
@Nonnull public static SimpleScheduleBuilder repeatHourlyForTotalCount(int nCount, int nHours)
Note: Total count = 1 (at start time) + repeat count
@Nonnull public SimpleTrigger build()
build in interface IScheduleBuilder<SimpleTrigger>TriggerBuilder.withSchedule(IScheduleBuilder)@Nonnull public SimpleScheduleBuilder withIntervalInMilliseconds(long nIntervalInMillis)
nIntervalInMillis - the number of seconds at which the trigger should repeat.ISimpleTrigger.getRepeatInterval(),
withRepeatCount(int)@Nonnull public SimpleScheduleBuilder withIntervalInSeconds(int nIntervalInSeconds)
nIntervalInSeconds - the number of seconds at which the trigger should repeat.ISimpleTrigger.getRepeatInterval(),
withRepeatCount(int)@Nonnull public SimpleScheduleBuilder withIntervalInMinutes(int nIntervalInMinutes)
nIntervalInMinutes - the number of seconds at which the trigger should repeat.ISimpleTrigger.getRepeatInterval(),
withRepeatCount(int)@Nonnull public SimpleScheduleBuilder withIntervalInHours(int intervalInHours)
intervalInHours - the number of seconds at which the trigger should repeat.ISimpleTrigger.getRepeatInterval(),
withRepeatCount(int)@Nonnull public SimpleScheduleBuilder withRepeatCount(int triggerRepeatCount)
triggerRepeatCount - the number of seconds at which the trigger should repeat.ISimpleTrigger.getRepeatCount(),
repeatForever()@Nonnull public SimpleScheduleBuilder repeatForever()
ISimpleTrigger.getRepeatCount(),
ISimpleTrigger.REPEAT_INDEFINITELY,
withIntervalInMilliseconds(long),
withIntervalInSeconds(int),
withIntervalInMinutes(int),
withIntervalInHours(int)@Nonnull public SimpleScheduleBuilder withMisfireHandlingInstructionIgnoreMisfires()
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY
instruction.ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY@Nonnull public SimpleScheduleBuilder withMisfireHandlingInstructionFireNow()
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW instruction.ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW@Nonnull public SimpleScheduleBuilder withMisfireHandlingInstructionNextWithExistingCount()
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT
instruction.ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT@Nonnull public SimpleScheduleBuilder withMisfireHandlingInstructionNextWithRemainingCount()
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT
instruction.ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT@Nonnull public SimpleScheduleBuilder withMisfireHandlingInstructionNowWithExistingCount()
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT
instruction.ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT@Nonnull public SimpleScheduleBuilder withMisfireHandlingInstructionNowWithRemainingCount()
ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT
instruction.ITrigger.EMisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNTCopyright © 2016–2021 Philip Helger. All rights reserved.