Friday, January 8, 2010

Job Storage in Quartz










Job Storage in Quartz


Quartz supports several different types of storage mechanisms for Scheduler information. Two types of Job storage are available in Quartz:


  • Memory (nonpersistent) storage

  • Persistent storage


By default, we've been using the memory storage mechanism in the examples from the past several chapters. Both types are designed to serve the same purpose: to store job information. How they each go about it, however, and what functionality they provide the Scheduler is very different.



The JobStore Interface


Quartz provides an interface for all types of job storage. The interface located in the org.quartz.spi package is called JobStore. All job storage mechanisms, regardless of where or how they store their information, must implement this interface.


The JobStore interface has too many methods to list here, but the API for the JobStore interface can be generalized into the following categories:


  • Job-related API

  • Trigger-related API

  • Calendar-related API

  • Scheduler-related API


Quartz users almost never access or see concrete classes that implement the JobStore interface; they are used internally by the Quartz Scheduler to retrieve job and trigger information during runtime. It is a worthwhile exercise, however, to familiarize yourself with each type so that you better understand the facilities these provide on your behalf and to choose the right one for your Quartz application.













No comments: