Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.quartz.ee.servlet
Class QuartzInitializerListener

    java.lang.Object
      org.quartz.ee.servlet.QuartzInitializerListener

All Implemented Interfaces:
  EventListener, ServletContextListener

public class QuartzInitializerListener
extends Object
implements ServletContextListener

A ServletContextListner that can be used to initialize Quartz.

You'll want to add something like this to your WEB-INF/web.xml file:

         <context-param>
             <param-name>config-file</param-name>
             <param-value>/some/path/my_quartz.properties</param-value>
         </context-param>
         <context-param>
             <param-name>shutdown-on-unload</param-name>
             <param-value>true</param-value>
         </context-param>
         <context-param>
             <param-name>start-scheduler-on-load</param-name>
             <param-value>true</param-value>
         </context-param>

         <listener>
             <listener-class>
                 org.quartz.ee.servlet.QuartzInitializerServletListener
             </listener-class>
         </listener>

The init parameter 'config-file' can be used to specify the path (and filename) of your Quartz properties file. If you leave out this parameter, the default ("quartz.properties") will be used.

The init parameter 'shutdown-on-unload' can be used to specify whether you want scheduler.shutdown() called when the servlet is unloaded (usually when the application server is being shutdown). Possible values are "true" or "false". The default is "true".

The init parameter 'start-scheduler-on-load' can be used to specify whether you want the scheduler.start() method called when the servlet is first loaded. If set to false, your application will need to call the start() method before teh scheduler begins to run and process jobs. Possible values are "true" or "false". The default is "true", which means the scheduler is started.

A StdSchedulerFactory instance is stored into the ServletContext. You can gain access to the factory from a ServletContext instance like this:
`StdSchedulerFactory factory = (StdSchedulerFactory) ctx .getAttribute(QuartzFactoryServlet.QUARTZ_FACTORY_KEY);`
Once you have the factory instance, you can retrieve the Scheduler instance by calling `getScheduler()` on the factory.

Author:
  James House, Chuck Cavaness, John Petrocik

Field Summary
`static String` | `QUARTZ_FACTORY_KEY`

Constructor Summary
`QuartzInitializerListener()`

Method Summary
`void` | `contextDestroyed(ServletContextEvent sce)`
`void` | `contextInitialized(ServletContextEvent sce)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### QUARTZ_FACTORY_KEY

    public static final String QUARTZ_FACTORY_KEY

See Also:
  Constant Field Values

Constructor Detail

### QuartzInitializerListener

    public QuartzInitializerListener()

Method Detail

### contextInitialized

    public void contextInitialized(ServletContextEvent sce)

  Specified by:
    `contextInitialized` in interface `ServletContextListener`

### contextDestroyed

    public void contextDestroyed(ServletContextEvent sce)

  Specified by:
    `contextDestroyed` in interface `ServletContextListener`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Quartz Enterprise Job Scheduler Project Page
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD