我在我的項目中使用石英。我的web應用程序顯然已經引起了內存泄漏當它停止,錯誤的是:如何防止石英內存泄漏
SEVERE: A web application appears to have started a TimerThread named [Timer-12] via the java.util.Timer API but has failed to stop it. To prevent a memory leak, the timer (and hence the associated thread) has been forcibly cancelled.
Jan 2, 2013 6:55:35 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: A web application appears to have started a thread named [DefaultQuartzScheduler_Worker-1] but has failed to stop it. This is very likely to create a memory leak.
我用org.quartz.ee.servlet.QuartzInitializerServlet
和org.quartz.ee.servlet.QuartzInitializerListener
。爲我廠的代碼是:
StdSchedulerFactory factory = (StdSchedulerFactory) context.getAttribute(QuartzInitializerListener.QUARTZ_FACTORY_KEY);
和石英設置在web.xml是:
<servlet>
<servlet-name>
QuartzInitializer
</servlet-name>
<display-name>
Quartz Initializer Servlet
</display-name>
<servlet-class>
org.quartz.ee.servlet.QuartzInitializerServlet
</servlet-class>
<load-on-startup>
1
</load-on-startup>
<init-param>
<param-name>shutdown-on-unload</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>wait-on-shutdown</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>start-scheduler-on-load</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<context-param>
<param-name>quartz:shutdown-on-unload</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>quartz:wait-on-shutdown</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>quartz:start-on-load</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>
org.quartz.ee.servlet.QuartzInitializerListener
</listener-class>
</listener>
請幫我解決這個內存泄漏!
不,「quartz:」前綴是正確的。請訪問:http://quartz-scheduler.org/api/2.0.0/org/quartz/ee/servlet/QuartzInitializerListener.html。 –
您正在閱讀錯誤的文檔:您的鏈接是「Listener」,您正在配置「Servlet」。出於某種原因,他們的表現並不一樣。請參閱:http://quartz-scheduler.org/api/2.0.0/org/quartz/ee/servlet/QuartzInitializerServlet.html –
此設置適用於org.quartz.ee.servlet.QuartzInitializerServlet和「quartz:」前綴爲for org.quartz.ee.servlet.QuartzInitializerListener。但是,我刪除了「quartz:」前綴但不正確的內存泄漏。 –