Chapter 4, "Scheduling Jobs," introduced the triggerUtils class in the org.quartz package, which simplifies the creation of triggers of both types. When possible, you should attempt to use the methods within the triggerUtils class to create your triggers.
For example, if you needed to execute a job every day at 5:30 PM, you could use the following code:
try { // A CronTrigger that fires @ 5:30PM CronTrigger trigger = new CronTrigger("CronTrigger", null, "0 30 17 ? * *"); } catch (ParseException ex) { logger.error("Couldn't parse cron expression", ex); }
Or you could use the triggerUtils like this:
// A CronTrigger that fires @ 5:30PM Trigger trigger = TriggerUtils.makeDailyTrigger(17, 30); trigger.setName("CronTrigger");
TRiggerUtils makes it easier and more convenient to use triggers, without giving up too much of the flexibility.
Using CronTriggers in the JobInitializationPlugin |
Scheduling in the Enterprise
Getting Started with Quartz
Hello, Quartz
Scheduling Jobs
Cron Triggers and More
JobStores and Persistence
Implementing Quartz Listeners
Using Quartz Plug-Ins
Using Quartz Remotely
Using Quartz with J2EE
Clustering Quartz
Quartz Cookbook
Quartz and Web Applications
Using Quartz with Workflow
Appendix A. Quartz Configuration Reference