From 3b9cd1faf326d8bc758f7a28528c154ab180495a Mon Sep 17 00:00:00 2001 From: huangli Date: Wed, 28 Mar 2018 21:17:04 +0800 Subject: [PATCH] close lettuce client in unit test --- .../alicp/jetcache/redis/lettuce/LettuceConnectionManager.java | 1 + .../alicp/jetcache/redis/lettuce4/LettuceConnectionManager.java | 1 + .../com/alicp/jetcache/redis/lettuce/RedisLettuceCacheTest.java | 2 ++ .../alicp/jetcache/redis/lettuce4/RedisLettuceCacheTest.java | 2 ++ 4 files changed, 6 insertions(+) diff --git a/jetcache-support/jetcache-redis-lettuce/src/main/java/com/alicp/jetcache/redis/lettuce/LettuceConnectionManager.java b/jetcache-support/jetcache-redis-lettuce/src/main/java/com/alicp/jetcache/redis/lettuce/LettuceConnectionManager.java index 6a18357b9..2c038268a 100644 --- a/jetcache-support/jetcache-redis-lettuce/src/main/java/com/alicp/jetcache/redis/lettuce/LettuceConnectionManager.java +++ b/jetcache-support/jetcache-redis-lettuce/src/main/java/com/alicp/jetcache/redis/lettuce/LettuceConnectionManager.java @@ -121,5 +121,6 @@ public void removeAndClose(AbstractRedisClient redisClient) { if (lo.connection != null) { lo.connection.close(); } + redisClient.shutdown(); } } diff --git a/jetcache-support/jetcache-redis-lettuce4/src/main/java/com/alicp/jetcache/redis/lettuce4/LettuceConnectionManager.java b/jetcache-support/jetcache-redis-lettuce4/src/main/java/com/alicp/jetcache/redis/lettuce4/LettuceConnectionManager.java index ccaf7823d..9c6cb3f9c 100644 --- a/jetcache-support/jetcache-redis-lettuce4/src/main/java/com/alicp/jetcache/redis/lettuce4/LettuceConnectionManager.java +++ b/jetcache-support/jetcache-redis-lettuce4/src/main/java/com/alicp/jetcache/redis/lettuce4/LettuceConnectionManager.java @@ -121,5 +121,6 @@ public void removeAndClose(AbstractRedisClient redisClient) { if (lo.connection != null) { lo.connection.close(); } + redisClient.shutdown(); } } diff --git a/jetcache-test/src/test/java/com/alicp/jetcache/redis/lettuce/RedisLettuceCacheTest.java b/jetcache-test/src/test/java/com/alicp/jetcache/redis/lettuce/RedisLettuceCacheTest.java index 248adfbfe..3a8d730b0 100644 --- a/jetcache-test/src/test/java/com/alicp/jetcache/redis/lettuce/RedisLettuceCacheTest.java +++ b/jetcache-test/src/test/java/com/alicp/jetcache/redis/lettuce/RedisLettuceCacheTest.java @@ -94,6 +94,8 @@ public void testWithMultiLevelCache() throws Exception { LoadingCacheTest.loadingCacheTest(MultiLevelCacheBuilder.createMultiLevelCacheBuilder() .expireAfterWrite(5000, TimeUnit.MILLISECONDS) .addCache(l1Cache, l2Cache), 50); + + LettuceConnectionManager.defaultManager().removeAndClose(client); } private void test(AbstractRedisClient client) throws Exception { diff --git a/jetcache-test/src/test/java/com/alicp/jetcache/redis/lettuce4/RedisLettuceCacheTest.java b/jetcache-test/src/test/java/com/alicp/jetcache/redis/lettuce4/RedisLettuceCacheTest.java index 6aef4ff50..a4710956e 100644 --- a/jetcache-test/src/test/java/com/alicp/jetcache/redis/lettuce4/RedisLettuceCacheTest.java +++ b/jetcache-test/src/test/java/com/alicp/jetcache/redis/lettuce4/RedisLettuceCacheTest.java @@ -94,6 +94,8 @@ public void testWithMultiLevelCache() throws Exception { LoadingCacheTest.loadingCacheTest(MultiLevelCacheBuilder.createMultiLevelCacheBuilder() .expireAfterWrite(5000, TimeUnit.MILLISECONDS) .addCache(l1Cache, l2Cache), 50); + + LettuceConnectionManager.defaultManager().removeAndClose(client); } private void test(AbstractRedisClient client) throws Exception {