Redisson 未关闭使 Java 虚拟机保持打开状态
Redisson not shutting down keeps Java VM open
我有以下简单代码:
RedissonClient redisson = Redisson.create();
RMap<Object, Object> mymap = redisson.getMap("mymap");
mymap.put("field1", "value1");
mymap.put("field1", "value2");
redisson.shutdown();
logger.info("Here but JVM still runs after this line");
输出为:
2018-02-01 15:24:14 INFO Version:41 - Redisson 3.6.0
2018-02-01 15:24:14 INFO MasterPubSubConnectionPool:144 - 1 connections initialized for /127.0.0.1:6379
2018-02-01 15:24:14 INFO MasterConnectionPool:144 - 10 connections initialized for /127.0.0.1:6379
2018-02-01 15:24:17 INFO RedisTest:21 - Here but JVM still runs after this line
正常关机除了关机还需要什么?我得到了线程转储并看到以下非守护线程:
"ObjectCleanerThread" #13 prio=1 os_prio=31 tid=0x00007f885a05e800 nid=0xa803 in Object.wait() [0x00007000092cf000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000076ab108b0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
- locked <0x000000076ab108b0> (a java.lang.ref.ReferenceQueue$Lock)
at io.netty.util.internal.ObjectCleaner.run(ObjectCleaner.java:52)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
似乎是 netty 的一个错误:https://github.com/netty/netty/issues/7617
问题好像已经解决了,但估计还没发布。
我有以下简单代码:
RedissonClient redisson = Redisson.create();
RMap<Object, Object> mymap = redisson.getMap("mymap");
mymap.put("field1", "value1");
mymap.put("field1", "value2");
redisson.shutdown();
logger.info("Here but JVM still runs after this line");
输出为:
2018-02-01 15:24:14 INFO Version:41 - Redisson 3.6.0
2018-02-01 15:24:14 INFO MasterPubSubConnectionPool:144 - 1 connections initialized for /127.0.0.1:6379
2018-02-01 15:24:14 INFO MasterConnectionPool:144 - 10 connections initialized for /127.0.0.1:6379
2018-02-01 15:24:17 INFO RedisTest:21 - Here but JVM still runs after this line
正常关机除了关机还需要什么?我得到了线程转储并看到以下非守护线程:
"ObjectCleanerThread" #13 prio=1 os_prio=31 tid=0x00007f885a05e800 nid=0xa803 in Object.wait() [0x00007000092cf000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x000000076ab108b0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
- locked <0x000000076ab108b0> (a java.lang.ref.ReferenceQueue$Lock)
at io.netty.util.internal.ObjectCleaner.run(ObjectCleaner.java:52)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
似乎是 netty 的一个错误:https://github.com/netty/netty/issues/7617
问题好像已经解决了,但估计还没发布。