我在取消部署使用 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) {
}
}
取消部署期间的线程转储如下所示: