【发布时间】:2017-11-14 22:29:48
【问题描述】:
我有一个类似的问题,如下面的帖子所述:
https://groups.google.com/d/msg/akka-user/Lp2hn4FfhU8/6a1EZVCmJpQJ
关闭Tomcat时,我得到:
10-Nov-2017 09:47:56.517 SEVERE [main]
org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [akka.actor.ActorCell$$anon$1] (value [akka.actor.ActorCell$$anon$1@1f9e9475]) and a value of type [scala.collection.immutable.Nil$] (value [List()]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
10-Nov-2017 09:47:56.517 SEVERE [main] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [ROOT] created a ThreadLocal with key of type [akka.actor.ActorCell$$anon$1] (value [akka.actor.ActorCell$$anon$1@1f9e9475]) and a value of type [scala.collection.immutable.Nil$] (value [List()]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
10-Nov-2017 09:47:56.535 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["http-nio-8080"]
10-Nov-2017 09:47:56.538 INFO [main] org.apache.coyote.AbstractProtocol.stop Stopping ProtocolHandler ["ajp-nio-8009"]
10-Nov-2017 09:47:56.540 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["http-nio-8080"]
10-Nov-2017 09:47:56.541 INFO [main] org.apache.coyote.AbstractProtocol.destroy Destroying ProtocolHandler ["ajp-nio-8009"]
Tomcat 被卡住了——要完全关闭它,我必须终止它的进程。 我尝试了上面帖子中提到的类似解决方案(我使用 Akka 2.5.6,因此不再有 shutdown() 和 awaitTermination() 方法):
@Override
public void contextDestroyed(ServletContextEvent servletContextEvent) {
ActorSystem actorSystem = (ActorSystem) WebApplicationContextUtils.getRequiredWebApplicationContext(servletContextEvent.getServletContext()).getBean("my-actor-system");
try {
Await.result((Awaitable) actorSystem.terminate(), Duration.create(10, TimeUnit.SECONDS));
} catch (Exception e) {
logger.warning(e.getMessage());
}
}
但这根本没有帮助。 Bean 的创建方式很简单:
@Bean
public ActorSystem actorSystem() {
return ActorSystem.create("my-actor-system");
}
有什么想法吗?
版本规格:
雄猫 9.0.1
Akka 2.5.6
春季4.2.3
【问题讨论】:
-
虽然我没有答案,但至少我有同样的问题。你并不孤单:-)
-
哈,谢谢伙计。我已经发布了我的解决方法,所以也许它对你也有帮助。