Package org.quartz.plugins.management
Class ShutdownHookPlugin
- java.lang.Object
-
- org.quartz.plugins.management.ShutdownHookPlugin
-
- All Implemented Interfaces:
SchedulerPlugin
public class ShutdownHookPlugin extends java.lang.Object implements SchedulerPlugin
This plugin catches the event of the JVM terminating (such as upon a CTRL-C) and tells the scheduler to shutdown.- Author:
- James House
- See Also:
Scheduler.shutdown(boolean)
-
-
Constructor Summary
Constructors Constructor Description ShutdownHookPlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.slf4j.LoggergetLog()voidinitialize(java.lang.String name, Scheduler scheduler, ClassLoadHelper classLoadHelper)Called during creation of theSchedulerin order to give theSchedulerPlugina chance to initialize.booleanisCleanShutdown()Determine whether or not the plug-in is configured to cause a clean shutdown of the scheduler.voidsetCleanShutdown(boolean b)Set whether or not the plug-in is configured to cause a clean shutdown of the scheduler.voidshutdown()Called in order to inform theSchedulerPluginthat it should free up all of it's resources because the scheduler is shutting down.voidstart()Called when the associatedScheduleris started, in order to let the plug-in know it can now make calls into the scheduler if it needs to.
-
-
-
Method Detail
-
isCleanShutdown
public boolean isCleanShutdown()
Determine whether or not the plug-in is configured to cause a clean shutdown of the scheduler.The default value is
true.- See Also:
Scheduler.shutdown(boolean)
-
setCleanShutdown
public void setCleanShutdown(boolean b)
Set whether or not the plug-in is configured to cause a clean shutdown of the scheduler.The default value is
true.- See Also:
Scheduler.shutdown(boolean)
-
getLog
protected org.slf4j.Logger getLog()
-
initialize
public void initialize(java.lang.String name, Scheduler scheduler, ClassLoadHelper classLoadHelper) throws SchedulerExceptionCalled during creation of the
Schedulerin order to give theSchedulerPlugina chance to initialize.- Specified by:
initializein interfaceSchedulerPlugin- Parameters:
name- The name by which the plugin is identified.scheduler- The scheduler to which the plugin is registered.classLoadHelper- The classLoadHelper theSchedulerFactoryis actually using- Throws:
SchedulerConfigException- if there is an error initializing.SchedulerException
-
start
public void start()
Description copied from interface:SchedulerPluginCalled when the associated
Scheduleris started, in order to let the plug-in know it can now make calls into the scheduler if it needs to.- Specified by:
startin interfaceSchedulerPlugin
-
shutdown
public void shutdown()
Called in order to inform the
SchedulerPluginthat it should free up all of it's resources because the scheduler is shutting down.- Specified by:
shutdownin interfaceSchedulerPlugin
-
-