我在取消部署使用redisson的Web应用程序时遇到问题,我在Glassfish 4.1.2(构建1)上运行java Web应用程序,当我尝试优雅地取消部署应用程序时,我得到了错误:
[2017-11-04T14:18:42.995+0100] [glassfish 5.0] [SEVERE] [] [javax.enterprise.web.util] [tid: _ThreadID=51 _ThreadName=admin-listener(1)] [timeMillis: 1509801522995] [levelValue: 1000] [[
The web application [/web] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@2727e742]) and a value of type [io.netty.util.internal.InternalThreadLocalMap] (value [io.netty.util.internal.InternalThreadLocalMap@71bcc175]) 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.]]
该应用程序的停止时间也大幅增加到大约5分钟,而不是正常的1分钟。如果我从应用程序中删除redisson,应用程序会定期停止。
我正在使用
Glassfish 4.1.2 (build 1)
java version "1.8.0_144"
Redisson 3.5.4
Netty 4.1.15.FInal
Redisson关机方法如下:
public static void shutdown() {
try {
redisson.shutdown(1,2,TimeUnit.SECONDS);
FastThreadLocal.removeAll();
FastThreadLocal.destroy();
InternalThreadLocalMap.remove();
InternalThreadLocalMap.destroy();
GlobalEventExecutor.INSTANCE.shutdownGracefully(1,2,TimeUnit.SECONDS).get();
}
} catch (Exception e) {
}
}
取消部署期间的线程转储如下所示: