public interface ScheduledTaskBuilder
Task
. To use the ScheduledTaskBuilder
,
inject a ScheduledTasks
and create a new ScheduledTaskBuilder
.
ScheduledTaskBuilder schedulerBuilder = factory.scheduledTask(MyTask.class); schedulerBuilder.withCronExpression("0/2 * * * * ?").schedule();
ScheduledTasks
Modifier and Type | Method and Description |
---|---|
void |
reschedule(String triggerName)
Reschedule the
Task with a new trigger |
void |
schedule()
Bind a
Task to a trigger and schedule. |
void |
unschedule(String triggerName)
Unschedule the
Task with provided trigger identification.triggerGroup is the Class of the Task implementation |
ScheduledTaskBuilder |
updateExistingTrigger()
Requests an existing trigger (sharing the same key as the new trigger) for this task to
be replaced with the new trigger.
|
ScheduledTaskBuilder |
withCronExpression(String cronExpression)
Sets the cron expression to base the schedule on.
|
ScheduledTaskBuilder |
withDataMap(Map<String,?> dataMap)
Sets the
Task 's data map |
ScheduledTaskBuilder |
withPriority(int priority)
Sets 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. |
ScheduledTaskBuilder |
withRequestRecovery(boolean requestRecovery)
Instructs the
Scheduler whether or not the Task should
be re-executed if a recovery or fail-over situation is
encountered. |
ScheduledTaskBuilder |
withStoreDurably(boolean storeDurably)
Whether or not the
Task should remain stored after it is
orphaned (no Trigger s point to it). |
ScheduledTaskBuilder |
withTaskName(String taskName)
Sets the
Task 's identity |
ScheduledTaskBuilder |
withTimeZone(TimeZone timeZone)
Sets the time zone for which the
cronExpression of this
CronTrigger will be resolved. |
ScheduledTaskBuilder |
withTrigger(Object trigger)
Sets the
Trigger that will be used to schedule
the Task . |
ScheduledTaskBuilder |
withTriggerName(String triggerName)
Sets the
Trigger name, must be unique within the group. |
ScheduledTaskBuilder withRequestRecovery(boolean requestRecovery)
Scheduler
whether or not the Task
should
be re-executed if a recovery
or fail-over
situation is
encountered.requestRecovery
- The activation flagScheduledTaskBuilder withStoreDurably(boolean storeDurably)
Task
should remain stored after it is
orphaned (no Trigger
s point to it).storeDurably
- The activation flagScheduledTaskBuilder withTriggerName(String triggerName)
Trigger
name, must be unique within the group.triggerName
- The Trigger
name, must be unique within the groupScheduledTaskBuilder withCronExpression(String cronExpression)
cronExpression
- The cron expression to base the schedule onScheduledTaskBuilder withTimeZone(TimeZone timeZone)
cronExpression
of this
CronTrigger
will be resolved.timeZone
- The time zone for which the cronExpression
of this CronTrigger
will be resolved.ScheduledTaskBuilder withTaskName(String taskName)
Task
's identitytaskName
- The Task
's nameScheduledTaskBuilder withDataMap(Map<String,?> dataMap)
Task
's data mapdataMap
- The Task
's data mapScheduledTaskBuilder withPriority(int priority)
priority
- - The Trigger's priorityScheduledTaskBuilder withTrigger(Object trigger)
Trigger
that will be used to schedule
the Task
.
Be aware that using using this method will override any other
Trigger
-related operation, like withTriggerName(String)
or withTimeZone(java.util.TimeZone)
trigger
- The Trigger
to associate with the Task
ScheduledTaskBuilder updateExistingTrigger()
void schedule()
Task
to a trigger and schedule.void reschedule(String triggerName)
Task
with a new trigger
The new trigger should be provided either using DSL
withTrigger() or throw @Scheduled CRON definition.
The DSL can precise attributes of the new trigger such as withTriggerName
Arguments provide the previous trigger identification to be replaced
triggerName
- the name of the trigger to reschedule.void unschedule(String triggerName)
Task
with provided trigger identification.Task
implementationtriggerName
- the name of the trigger to unschedule.Copyright © 2013-2018–2019 SeedStack. All rights reserved.