public class JobBuilder extends Object
JobBuilder is used to instantiate JobDetails.
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 and Type | Method and Description |
|---|---|
JobDetail |
build()
Produce the
JobDetail instance defined by this JobBuilder. |
JobBuilder |
isConcurrencyAllowed(boolean isConcurrencyAllowed)
The default behavior is to veto any job is currently running concurrent.
|
static JobBuilder |
newJobBuilder()
Create a JobBuilder with which to define a
JobDetail. |
static JobBuilder |
newJobBuilder(Class<? extends Job> jobClass)
Create a JobBuilder with which to define a
JobDetail, and set the class name of the Job to be executed. |
JobBuilder |
ofType(Class<? extends Job> jobClass)
Set the class which will be instantiated and executed when a Trigger fires that is associated with this JobDetail.
|
JobBuilder |
usingJobData(JobDataMap newJobDataMap)
Set the JobDetail's
JobDataMap |
JobBuilder |
withDescription(String description)
Set the given (human-meaningful) description of the Job.
|
JobBuilder |
withIdentity(String key)
Use a
String to identify the JobDetail. |
public static JobBuilder newJobBuilder()
JobDetail.public static JobBuilder newJobBuilder(Class<? extends Job> jobClass)
JobDetail, and set the class name of the Job to be executed.public JobDetail build()
JobDetail instance defined by this JobBuilder.public JobBuilder withIdentity(String key)
String to identify the JobDetail.
If none of the 'withIdentity' methods are set on the JobBuilder, then a random, unique JobKey will be generated.
key - the Job's JobKeypublic JobBuilder withDescription(String description)
description - the description for the JobJobDetail.getDescription()public JobBuilder ofType(Class<? extends Job> jobClass)
jobClass - a class implementing the Job interface.JobDetail.getJobClass()public JobBuilder isConcurrencyAllowed(boolean isConcurrencyAllowed)
isConcurrencyAllowed - public JobBuilder usingJobData(JobDataMap newJobDataMap)
JobDataMapJobDetail.getJobDataMap()Copyright © 2011–2017 Knowm Inc.. All rights reserved.