diff --git a/redisson/src/main/java/org/redisson/connection/ClientConnectionsEntry.java b/redisson/src/main/java/org/redisson/connection/ClientConnectionsEntry.java index e76f857de..0c66c855b 100644 --- a/redisson/src/main/java/org/redisson/connection/ClientConnectionsEntry.java +++ b/redisson/src/main/java/org/redisson/connection/ClientConnectionsEntry.java @@ -49,12 +49,10 @@ public class ClientConnectionsEntry { private volatile FreezeReason freezeReason; final RedisClient client; - private volatile NodeType nodeType; + private final NodeType nodeType; private final IdleConnectionWatcher idleConnectionWatcher; private final ConnectionManager connectionManager; - private final MasterSlaveServersConfig config; - private volatile boolean initialized = false; private final WrappedLock lock = new WrappedLock(); @@ -67,7 +65,6 @@ public class ClientConnectionsEntry { this.idleConnectionWatcher = connectionManager.getServiceManager().getConnectionWatcher(); this.connectionManager = connectionManager; this.nodeType = nodeType; - this.config = config; this.pubSubConnectionsHolder = new ConnectionsHolder<>(client, config.getSubscriptionConnectionPoolSize(), r -> r.connectPubSubAsync(), connectionManager.getServiceManager(), false); @@ -96,10 +93,6 @@ public class ClientConnectionsEntry { this.initialized = isInited; } - public void setNodeType(NodeType nodeType) { - this.nodeType = nodeType; - } - public NodeType getNodeType() { return nodeType; } @@ -144,6 +137,11 @@ public class ClientConnectionsEntry { } public void nodeDown() { + nodeDown(connectionsHolder); + reattachPubSub(); + } + + protected final void nodeDown(ConnectionsHolder connectionsHolder) { connectionsHolder.getFreeConnectionsCounter().removeListeners(); for (RedisConnection connection : connectionsHolder.getAllConnections()) {