
我自己解决了这个问题。与其他答案相反,我不建议发出该
t.stop()命令。此方法已被弃用,这是有充分理由的。请参考Oracle这样做的原因。
但是,有一种解决方案可以消除此错误,而无需诉诸
t.stop()…
您可以使用提供的大多数代码@Oso,只需替换以下部分
Set<Thread> threadSet = Thread.getAllStackTraces().keySet();Thread[] threadArray = threadSet.toArray(new Thread[threadSet.size()]);for(Thread t:threadArray) { if(t.getName().contains("Abandoned connection cleanup thread")) { synchronized(t) { t.stop(); //don't complain, it works } }}使用MySQL驱动程序提供的以下方法替换它:
try { AbandonedConnectionCleanupThread.shutdown();} catch (InterruptedException e) { logger.warn("SEVERE problem cleaning up: " + e.getMessage()); e.printStackTrace();}这应该正确地关闭线程,并且错误应该消失。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)