public final class JobSchedulerBuilder extends Object
Job and add to a Scheduler,
and associate the related Trigger with it.| Constructor and Description |
|---|
JobSchedulerBuilder(Class<? extends org.quartz.Job> jobClass)
Creates a new
JobSchedulerBuilder instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
schedule(org.quartz.Scheduler scheduler)
Add the produced
Job to the given Scheduler,
and associate the related Trigger with it. |
JobSchedulerBuilder |
updateExistingTrigger()
Requests an existing trigger (sharing the same key as the new trigger) for this job to
be replaced with the new trigger.
|
JobSchedulerBuilder |
withCronExpression(String cronExpression)
Sets the cron expression to base the schedule on.
|
JobSchedulerBuilder |
withJobGroup(String jobGroup)
Sets the
Job group. |
JobSchedulerBuilder |
withJobName(String jobName)
Sets the
Job name, must be unique within the group. |
JobSchedulerBuilder |
withPriority(int priority)
Sets the
Trigger's priority. |
JobSchedulerBuilder |
withRequestRecovery(boolean requestRecovery)
Instructs the
Scheduler whether or not the Job should
be re-executed if a recovery or fail-over situation is
encountered. |
JobSchedulerBuilder |
withStoreDurably(boolean storeDurably)
Whether or not the
Job should remain stored after it is
orphaned (no Triggers point to it). |
JobSchedulerBuilder |
withTimeZone(TimeZone timeZone)
Sets the time zone for which the
cronExpression of this
CronTrigger will be resolved. |
JobSchedulerBuilder |
withTrigger(org.quartz.Trigger trigger)
Sets the
Trigger that will be used to schedule
the Job. |
JobSchedulerBuilder |
withTriggerGroup(String triggerGroup)
Sets the
Trigger group. |
JobSchedulerBuilder |
withTriggerName(String triggerName)
Sets the
Trigger name, must be unique within the group. |
public JobSchedulerBuilder(Class<? extends org.quartz.Job> jobClass)
JobSchedulerBuilder instance.
This class can't be instantiated by users.jobClass - The type of the Job to be executedpublic JobSchedulerBuilder withJobName(String jobName)
Job name, must be unique within the group.jobName - The Job name, must be unique within the grouppublic JobSchedulerBuilder withJobGroup(String jobGroup)
Job group.jobGroup - The Job grouppublic JobSchedulerBuilder withRequestRecovery(boolean requestRecovery)
Scheduler whether or not the Job should
be re-executed if a recovery or fail-over situation is
encountered.requestRecovery - The activation flagpublic JobSchedulerBuilder withStoreDurably(boolean storeDurably)
Job should remain stored after it is
orphaned (no Triggers point to it).storeDurably - The activation flagpublic JobSchedulerBuilder withTriggerName(String triggerName)
Trigger name, must be unique within the group.triggerName - The Trigger name, must be unique within the grouppublic JobSchedulerBuilder withTriggerGroup(String triggerGroup)
Trigger group.triggerGroup - The Trigger grouppublic JobSchedulerBuilder withCronExpression(String cronExpression)
cronExpression - The cron expression to base the schedule onpublic JobSchedulerBuilder withTimeZone(TimeZone timeZone)
cronExpression of this
CronTrigger will be resolved.timeZone - The time zone for which the cronExpression
of this CronTrigger will be resolved.public JobSchedulerBuilder withPriority(int priority)
Trigger's priority. When more than one Trigger have the same
fire time, the scheduler will fire the one with the highest priority
first.priority - The Trigger's prioritypublic JobSchedulerBuilder withTrigger(org.quartz.Trigger trigger)
Trigger that will be used to schedule
the Job.
Be aware that using using this method will override any other
Trigger-related operation, like withTriggerGroup(String)
or withTimeZone(TimeZone)trigger - The Trigger to associate with the Jobpublic JobSchedulerBuilder updateExistingTrigger()
public void schedule(@Nonnull org.quartz.Scheduler scheduler) throws org.quartz.SchedulerException
Job to the given Scheduler,
and associate the related Trigger with it.
scheduler - The given Schedulerorg.quartz.SchedulerException - If any error occurs