From ed247c0ce7eb0608a2ecc807fa31c74e91aea6f5 Mon Sep 17 00:00:00 2001 From: Nikita Date: Thu, 8 Feb 2018 12:32:10 +0300 Subject: [PATCH] refactoring --- .../org/redisson/connection/ConnectionManager.java | 4 ++-- .../connection/MasterSlaveConnectionManager.java | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/redisson/src/main/java/org/redisson/connection/ConnectionManager.java b/redisson/src/main/java/org/redisson/connection/ConnectionManager.java index 59634c085..c8ccbf8cb 100644 --- a/redisson/src/main/java/org/redisson/connection/ConnectionManager.java +++ b/redisson/src/main/java/org/redisson/connection/ConnectionManager.java @@ -107,13 +107,13 @@ public interface ConnectionManager { RFuture psubscribe(String pattern, Codec codec, AsyncSemaphore semaphore, RedisPubSubListener... listeners); - Codec unsubscribe(String channelName, AsyncSemaphore lock); + void unsubscribe(String channelName, AsyncSemaphore lock); RFuture unsubscribe(String channelName, boolean temporaryDown); RFuture punsubscribe(String channelName, boolean temporaryDown); - Codec punsubscribe(String channelName, AsyncSemaphore lock); + void punsubscribe(String channelName, AsyncSemaphore lock); void shutdown(); diff --git a/redisson/src/main/java/org/redisson/connection/MasterSlaveConnectionManager.java b/redisson/src/main/java/org/redisson/connection/MasterSlaveConnectionManager.java index f8c5d7b2a..9f80bbc2e 100644 --- a/redisson/src/main/java/org/redisson/connection/MasterSlaveConnectionManager.java +++ b/redisson/src/main/java/org/redisson/connection/MasterSlaveConnectionManager.java @@ -587,14 +587,13 @@ public class MasterSlaveConnectionManager implements ConnectionManager { }); } - public Codec unsubscribe(final String channelName, final AsyncSemaphore lock) { + public void unsubscribe(final String channelName, final AsyncSemaphore lock) { final PubSubConnectionEntry entry = name2PubSubConnection.remove(channelName); if (entry == null) { lock.release(); - return null; + return; } - Codec entryCodec = entry.getConnection().getChannels().get(channelName); entry.unsubscribe(channelName, new BaseRedisPubSubListener() { @Override @@ -612,8 +611,6 @@ public class MasterSlaveConnectionManager implements ConnectionManager { } }); - - return entryCodec; } @Override @@ -645,14 +642,13 @@ public class MasterSlaveConnectionManager implements ConnectionManager { return RedissonPromise.newSucceededFuture(entryCodec); } - public Codec punsubscribe(final String channelName, final AsyncSemaphore lock) { + public void punsubscribe(final String channelName, final AsyncSemaphore lock) { final PubSubConnectionEntry entry = name2PubSubConnection.remove(channelName); if (entry == null) { lock.release(); - return null; + return; } - Codec entryCodec = entry.getConnection().getPatternChannels().get(channelName); entry.punsubscribe(channelName, new BaseRedisPubSubListener() { @Override @@ -670,8 +666,6 @@ public class MasterSlaveConnectionManager implements ConnectionManager { } }); - - return entryCodec; }