[英]The web application appears to have started a thread named but has failed to stop it. This is very likely to create a memory leak
[英]Quartz2.x: GRAVE: The web application [/servlet] appears to have started a thread named [Thread-4] but has failed to stop it
當我用Quartz 2.x運行我的Web應用程序時,我收到此消息。 它運行正常,但在聲明服務器時出現此錯誤
INFO: Server startup in 1792 ms
20 mai 2014 18:18:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
GRAVE: The web application [/servlet] appears to have started a thread named [Thread-4] but has failed to stop it. This is very likely to create a memory leak.
20 mai 2014 18:18:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
GRAVE: The web application [/servlet] appears to have started a thread named [CronTriggers_Worker-1] but has failed to stop it. This is very likely to create a memory leak.
20 mai 2014 18:18:59 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
GRAVE: The web application [/servlet] appears to have started a thread named [CronTriggers_Worker-2] but has failed to stop it. This is very likely to create a memory leak.
任何幫助表示贊賞。
這可能是由於在Tomcat關閉或重新部署Web應用程序時未關閉Quartz調度程序引起的(很可能是您的情況)。
您將需要實現ServletContextListener,並在其contextDestroyed方法中執行以下操作:
scheduler.shutdown( true ); // true = wait for jobs to complete
// you may want to give Quartz some extra time to shutdown
//Thread.sleep(1000);
您可能還需要配置Quartz線程池,以將其線程標記為“守護程序線程”(org.quartz.threadPool.makeThreadsDaemons = true),因為它們不會阻止JVM停止運行。 否則,JVM將等待所有這些工作線程完成。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.