8.5 Going Further with Quartz

The sophistication of the Quartz scheduler allows you to provide for much richer job scheduling than that shown. You can build custom Quartz Calendar objects to describe arbitrary schedules (for example, a custom Quartz Calendar object might be provided to indicate company holidays). The infrastructure shown here shows how this scheduling system can be combined with other libraries and various web services to provide a new, rich form of data manipulation beyond that which can be provided by (for example) scraping HTML.

Beyond web services, Quartz allows you to add the notion of "time" to your application in a very durable fashion. For example, let's say that you wish to send an email reminding users to register a downloaded product exactly twice, once after a day and once after a week. Leveraging Quartz allows you to reliably build this sort of functionality into your application (date and time calculations in particular can be difficult, especially if the application goes offline for a period of time). For a broader discussion of Quartz and a detailed comparison with the basic functionality provided by java.util.Timer, see "Job Scheduling in Java," by Dejan Bosanac (http://www.onjava.com/pub/a/onjava/2004/03/10/quartz.html).

One thing that's nice about all of this is the ability to provide a system based on standards (in particular, XML and the various web services). The next chapter looks at a system which relies on a somewhat more archaic format.