The Quartz Scheduler

The Quartz framework contains many classes and interfaces separated into approximately 11 packages. Much of the interaction that you'll have with the framework will take place with the org.quartz package. This package contains the public API of the Quartz framework.

We don't attempt to cover every class and interface within the framework. Instead, we present a subset of the components that will help you understand how Quartz does what it does. Figure 4.1 shows a compacted class diagram for the essential Scheduler components.

Figure 4.1. Quartz class diagram (only major components shown)

The Scheduler is the primary API of Quartz. For Quartz users, most of the interaction with the framework takes place with the Scheduler.Clients interact with the Scheduler through the org.quartz.Scheduler interface. The Scheduler implementation, in this case, is a proxy, and the calls are forwarded to an instance of the QuartzScheduler. The QuartzScheduler is not visible to the client, and there's no direct interaction with the instance.

The QuartzScheduler is at the root of the framework and is the engine that drives the entire framework. Not all of the functionality is built directly into the QuartzScheduler, however. The framework has been designed to be flexible and configurable so that many of the important functions are carried out by separate components and subframeworks. This means that Quartz users can substitute their own versions of certain key features for the default ones. Still, even though the QuartzScheduler delegates some of its responsibility, it is still in charge of the overall process of scheduling.

The Quartz Scheduler Hierarchy

Clients can interact with two types of Schedulers, shown in Figure 4.2. Both implement the org.quartz.Scheduler interface.

Figure 4.2. The org.quartz.Scheduler hierarchy

As a Quartz user, you interact with the classes that implement the org.quartz.Scheduler interface. Before you can invoke any of its API, you need to know how to create an instance of the Scheduler.

The Quartz SchedulerFactory

Категории