[Abandoned connection cleanup thread] but has failed to stop it.

錯誤這樣樣子:

警告: The web application [community4] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 java.lang.Object.wait(Native Method)
 java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
 com.mysql.cj.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43)

mysql的cleanup的線程沒有關閉而已。

可以在ServletContextListener裏如下代碼:

AbandonedConnectionCleanupThread.shutdown();
Thread.sleep(2000);

Thread.sleep(2000);是爲了確保不會打印該異常

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章