Thread Use in Listeners

As you look at the methods in the listener interfaces, you might wonder what role threads play in the invocation of the listener methods. There is indeed a sequence to the listener method calls, as you can imagine by looking at the names. During the life cycle of a job execution, the order of calls to the listener is generally fixed. Figure 7.2 illustrates the order in which the listener methods are called and how the worker threads are involved.

Figure 7.2. Listener methods are called in a particular sequence.

The sequence of listener method calls is fixed. As Figure 7.2 shows, the same thread that calls the job's execute() method is used to call the JobListener and triggerListener methods before and after the execution. This is important to know if you are using any sort of third-party thread-management tools or have decided to implement your own thread-pool management. It can also have a negative impact on performance if you implement long-running logic in the listener methods. Because the thread that invokes the listener methods is the same worker thread executing jobs, you should not implement listener methods that are complicated and that take a long time to complete. Keep their execution times to a minimum.


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

show all menu





Quartz Job Scheduling Framework(c) Building Open Source Enterprise Applications
Quartz Job Scheduling Framework: Building Open Source Enterprise Applications
ISBN: 0131886703
EAN: 2147483647
Year: N/A
Pages: 148
Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net