Mar 152016
 Posted by on March 15, 2016 at 3:11 am FAQ, Threads and Synchronization  Add comments

Most of you already be knowing about Quartz scheduler but just for information Quartz scheduler is a job scheduling library that can be integrated into a wide variety of enterprise class Java applications. If you want to know more about how to implement the Quatrz scheduler in your application then you can check Quartz implementation link. Here in this article we are focusing on Quartz scheduler shutdown process, as this is where most of developers miss out details.

Issues faced due to improper implementation of Quartz Scheduler Shutdown is servers will not go down in graceful or sometime force shutdown’s also and will casue servers to go to incompatible state and Application process will get hung till we manually kill the process from back end and restart again.

To over come issues like this Quartz have provided a quartz scheduler shutdown hook plugin which catches the event of the JVM terminating, and calls shutdown on the scheduler.

Sample configuration needs to be added to for ShutdownHookPlugin are

org.quartz.plugin.shutdownhook.class =
org.quartz.plugin.shutdownhook.cleanShutdown = true

But it is recommended to use below configurations in so that the JVM will not hang while waiting for the Quartz scheduler threads to close themselves during any recycle processes.

org.quartz.plugin.shutdownhook.class =
org.quartz.plugin.shutdownhook.cleanShutdown = true


We need to mark the scheduler threads daemon as a daemon thread is a thread that does not prevent the JVM from exiting when the program finishes but the thread is still running which in turn does not interfere with the JVM while shutting down. An example for a daemon thread is the garbage collection.


Can be set to “true” to have the threads in the pool created as daemon threads. Default is “false”.


A boolean value (‘true’ or ‘false’) that specifies whether the main thread of the scheduler should be a daemon thread or not.

Logs and Outputs:

When you have successfully implemented Quartz shutdown hook plugin you shall see below initialization logs while starting the JVM:

INFO: Quartz Scheduler v.2.2.1 created.
Feb 19, 2016 6:23:34 AM initialize
INFO: Registering Quartz shutdown hook.

While shutting down JVM:

Feb 18, 2016 6:32:06 AM$1 run
INFO: Shutting down Quartz...

© Incase of any copyright infringements please check copyrights page for faster resolutions.

Leave a Reply

Show Buttons
Hide Buttons