关于java(Quartz)调度的初学者问题
我正在研究一个已经使用 Quartz 的网络应用程序。
在 web.xml 中有:
<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>
这个 servlet 的工作是什么以及它的生命周期?
我知道它对石英作业调度进行了一些初始化,但不确定具体是什么。
由于它没有 servlet-mapping
,我认为它不应该处理请求。
如有任何帮助,我们将不胜感激。
谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
QuartzInitializerServlet 启动调度程序(通常是 StdScheduler )及其工作线程。配置将从文件
quartz.properties
加载。如果您只使用一个调度程序,则可以使用 QuartzInitializerListener
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
没错,这个 servlet 不应该处理请求,而只是用于quartz 初始化。
事实上,doPost 和 doGet 方法的实现会返回一个错误:
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: