gpt4 book ai didi

java - quartz 2.x : GRAVE: The web application [/servlet] appears to have started a thread named [Thread-4] but has failed to stop it

转载 作者:行者123 更新时间:2023-11-30 03:53:47 24 4
gpt4 key购买 nike

当我使用 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 将等待所有这些工作线程完成。

关于java - quartz 2.x : GRAVE: The web application [/servlet] appears to have started a thread named [Thread-4] but has failed to stop it,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23765286/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com