我正在 linux 服务器上使用 tomcat8 和 jdk1.8 运行 Web 应用程序。
当我关闭 tomcat 时,我收到以下警告消息:
WARNING [main] org.apache.tomcat.util.net.AbstractEndpoint.shutdownExecutor The executor associated with thread pool [http-apr-8080] has not fully shutdown. Some application threads may still be running
注意:我只在关闭 tomcat 时收到此警告,而不是在取消部署我的应用程序时收到此警告。
我怎样才能“修复”这个警告,这样消息就不会出现了。 我在应用程序运行时使用 Jstack 进行了线程转储,我看到了几个 http-apr-8080-exec 线程。
谢谢
最佳答案
我们必须在关闭 tomcat 之前停止任何应用程序,因为 servlet 可能会在关闭过程中处理请求。
引用: https://www.safaribooksonline.com/library/view/tomcat-the-definitive/0596003188/ch01s02.html
请检查部分 - 重新启动 Tomcat 它说 “Java Servlet 规范还规定,在关闭时,servlet 容器必须等待每个 servlet 完成为所有正在进行的请求提供服务,或者在让 servlet 停止服务之前等待特定于容器的超时持续时间。对于 Tomcat 4,每个 servlet 的超时持续时间最多为半秒。当 servlet 行为不当并且需要很长时间才能完成请求服务时,Tomcat 会发现 servlet 花费的时间太长并强行将其停止服务,因此Tomcat 可以关闭。不过,此处理需要时间,并且会减慢 Tomcat 自身的关闭处理速度。”
最佳实践: 当您从 tomcat 停止应用程序时,servlet 停止服务。因此您不会遇到这个问题。
请按照先停止应用程序,关闭tomcat服务器的流程
关于java - Tomcat 警告 : The executor associated with thread pool [http-apr-8080] has not fully shutdown,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35149888/