spring-cloud-alibaba Nacos common: SharedPublisher thread not closed while shutdown application in Tomcat

q8l4jmvw  于 2个月前  发布在  Spring
关注(0)|答案(1)|浏览(44)

我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。另外请按照如下要求提交相关信息节省社区维护同学的理解成本,否则该讨论极有可能直接被忽视或关闭。
We recommend using English. If you are non-native English speaker, you can use the translation software. We recommend using English. If you are non-native English speaker, you can use the translation software. In addition, please submit relevant information according to the following requirements to save the understanding cost of community maintenances, otherwise the discussion is very likely to be ignored or closed directly.

Which Component
spring-cloud-starter-alibaba-nacos-config 2021.0.5.0
Tomcat 9
Nacos Config

Describe what problem you have encountered
We're using nacos config discovery feature in web application, eveytime when we stop/start or re-deploy application in Tomcat, there is a thread called 'nacos.publisher-com.alibaba.nacos.common.notify.SlowEvent' remain in JVM.

Describe what information you have read
I've invoke method 'NotifyCenter.shutdown()' in contextDestory, right before a 'configService.shutDown()' and it still not working.

I found in INSTANCE.sharePublisher.shutdown(); it will clear the BlockingQueue and set status to shutdown which means the while loop in run() will stop executing, but this thread still exist in JVM.

My question is, how should i remove this publisher thread from JVM by the time i close web application.

aiazj4mn

aiazj4mn1#

I found this thread is created by DefaultPulisher which is firstly initilized by NotifyCenter in it's static block. So, does it mean this DefaultPulisher thread will never be gc as it's referenced in a static block or until the classloader been destroyed?

相关问题