TriggerBuilder
is used to instantiate {@link Trigger}s. The builder will always try to keep itself in a valid state, with reasonable defaults set for calling build() at any point. For instance if you do not invoke withSchedule(..) method, a default schedule of firing once immediately will be used. As another example, if you do not invoked withIdentity(..) a trigger name will be generated for you.
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);@see JobBuilder @see ScheduleBuilder @see DateBuilder @see Trigger
|
|
|
|
|
|