public class SimpleScheduleBuilder extends ScheduleBuilder<SimpleTrigger>
SimpleScheduleBuilder
is a ScheduleBuilder
that defines strict/literal interval-based schedules for
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);
Modifier | Constructor and Description |
---|---|
protected |
SimpleScheduleBuilder() |
Modifier and Type | Method and Description |
---|---|
MutableTrigger |
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 hours)
Create a SimpleScheduleBuilder set to repeat forever with an interval
of the given number of hours.
|
static SimpleScheduleBuilder |
repeatHourlyForTotalCount(int count)
Create a SimpleScheduleBuilder set to repeat the given number
of times - 1 with a 1 hour interval.
|
static SimpleScheduleBuilder |
repeatHourlyForTotalCount(int count,
int hours)
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 count)
Create a SimpleScheduleBuilder set to repeat the given number
of times - 1 with a 1 minute interval.
|
static SimpleScheduleBuilder |
repeatMinutelyForTotalCount(int count,
int minutes)
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 count)
Create a SimpleScheduleBuilder set to repeat the given number
of times - 1 with a 1 second interval.
|
static SimpleScheduleBuilder |
repeatSecondlyForTotalCount(int count,
int seconds)
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 intervalInMillis)
Specify a repeat interval in milliseconds.
|
SimpleScheduleBuilder |
withIntervalInMinutes(int intervalInMinutes)
Specify a repeat interval in minutes - which will then be multiplied
by 60 * 1000 to produce milliseconds.
|
SimpleScheduleBuilder |
withIntervalInSeconds(int intervalInSeconds)
Specify a repeat interval in seconds - which will then be multiplied
by 1000 to produce milliseconds.
|
SimpleScheduleBuilder |
withMisfireHandlingInstructionFireNow()
If the Trigger misfires, use the
SimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOW instruction. |
SimpleScheduleBuilder |
withMisfireHandlingInstructionIgnoreMisfires()
If the Trigger misfires, use the
Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY instruction. |
SimpleScheduleBuilder |
withMisfireHandlingInstructionNextWithExistingCount()
If the Trigger misfires, use the
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT instruction. |
SimpleScheduleBuilder |
withMisfireHandlingInstructionNextWithRemainingCount()
If the Trigger misfires, use the
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT instruction. |
SimpleScheduleBuilder |
withMisfireHandlingInstructionNowWithExistingCount()
If the Trigger misfires, use the
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT instruction. |
SimpleScheduleBuilder |
withMisfireHandlingInstructionNowWithRemainingCount()
If the Trigger misfires, use the
SimpleTrigger.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.
|
public static SimpleScheduleBuilder simpleSchedule()
public static SimpleScheduleBuilder repeatMinutelyForever()
public static SimpleScheduleBuilder repeatMinutelyForever(int minutes)
public static SimpleScheduleBuilder repeatSecondlyForever()
public static SimpleScheduleBuilder repeatSecondlyForever(int seconds)
public static SimpleScheduleBuilder repeatHourlyForever()
public static SimpleScheduleBuilder repeatHourlyForever(int hours)
public static SimpleScheduleBuilder repeatMinutelyForTotalCount(int count)
Note: Total count = 1 (at start time) + repeat count
public static SimpleScheduleBuilder repeatMinutelyForTotalCount(int count, int minutes)
Note: Total count = 1 (at start time) + repeat count
public static SimpleScheduleBuilder repeatSecondlyForTotalCount(int count)
Note: Total count = 1 (at start time) + repeat count
public static SimpleScheduleBuilder repeatSecondlyForTotalCount(int count, int seconds)
Note: Total count = 1 (at start time) + repeat count
public static SimpleScheduleBuilder repeatHourlyForTotalCount(int count)
Note: Total count = 1 (at start time) + repeat count
public static SimpleScheduleBuilder repeatHourlyForTotalCount(int count, int hours)
Note: Total count = 1 (at start time) + repeat count
public MutableTrigger build()
build
in class ScheduleBuilder<SimpleTrigger>
TriggerBuilder.withSchedule(ScheduleBuilder)
public SimpleScheduleBuilder withIntervalInMilliseconds(long intervalInMillis)
intervalInMillis
- the number of seconds at which the trigger should repeat.SimpleTrigger.getRepeatInterval()
,
withRepeatCount(int)
public SimpleScheduleBuilder withIntervalInSeconds(int intervalInSeconds)
intervalInSeconds
- the number of seconds at which the trigger should repeat.SimpleTrigger.getRepeatInterval()
,
withRepeatCount(int)
public SimpleScheduleBuilder withIntervalInMinutes(int intervalInMinutes)
intervalInMinutes
- the number of seconds at which the trigger should repeat.SimpleTrigger.getRepeatInterval()
,
withRepeatCount(int)
public SimpleScheduleBuilder withIntervalInHours(int intervalInHours)
intervalInHours
- the number of seconds at which the trigger should repeat.SimpleTrigger.getRepeatInterval()
,
withRepeatCount(int)
public SimpleScheduleBuilder withRepeatCount(int triggerRepeatCount)
triggerRepeatCount
- the number of seconds at which the trigger should repeat.SimpleTrigger.getRepeatCount()
,
repeatForever()
public SimpleScheduleBuilder repeatForever()
SimpleTrigger.getRepeatCount()
,
SimpleTrigger.REPEAT_INDEFINITELY
,
withIntervalInMilliseconds(long)
,
withIntervalInSeconds(int)
,
withIntervalInMinutes(int)
,
withIntervalInHours(int)
public SimpleScheduleBuilder withMisfireHandlingInstructionIgnoreMisfires()
Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY
instruction.Trigger.MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY
public SimpleScheduleBuilder withMisfireHandlingInstructionFireNow()
SimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOW
instruction.SimpleTrigger.MISFIRE_INSTRUCTION_FIRE_NOW
public SimpleScheduleBuilder withMisfireHandlingInstructionNextWithExistingCount()
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT
instruction.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT
public SimpleScheduleBuilder withMisfireHandlingInstructionNextWithRemainingCount()
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT
instruction.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT
public SimpleScheduleBuilder withMisfireHandlingInstructionNowWithExistingCount()
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT
instruction.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT
public SimpleScheduleBuilder withMisfireHandlingInstructionNowWithRemainingCount()
SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT
instruction.SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT
Copyright 2001-2019, Terracotta, Inc.