Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

beginner's question on java (Quartz) scheduling

I am looking into a web app that already uses Quartz.
In the web.xml there is:

<servlet>
  <servlet-name>QuartzInitializer</servlet-name>
  <display-name>Quartz-Init Servlet</display-name>
  <servlet-class>
    org.quartz.ee.servlet.QuartzInitializerServlet
  </servlet-class>
  <load-on-startup>5</load-on-startup>
</servlet>

What is the job of this servlet and it's lifecycle?
I understand that it does some intialization for the quartz job scheduling but not exactly sure what.
Since there is no servlet-mapping for it, I assume that it is not supposed to handle requests.
Any help is appreciated.
Thanks

like image 887
Cratylus Avatar asked Feb 28 '11 19:02

Cratylus


2 Answers

QuartzInitializerServlet starts the Scheduler (typically a StdScheduler) and its worker threads. The configuration will be loaded from the file quartz.properties.

If you are only using one scheduler, you can use QuartzInitializerListener

like image 163
Uriah Carpenter Avatar answered Sep 28 '22 17:09

Uriah Carpenter


It's right, this servlet is not supposed to handle requests, but only for quartz initialization. In fact, the implementation of the methods doPost and doGet returns an error:

response.sendError(HttpServletResponse.SC_FORBIDDEN);
like image 23
javanna Avatar answered Sep 28 '22 19:09

javanna