当我使用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.任何帮助都很感激。
发布于 2014-05-21 16:25:27
这可能是由于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将等待所有这些工作线程完成。
https://stackoverflow.com/questions/23765286
复制相似问题