Signed-off-by: xujie <mikawudi@qq.com>
pull/3455/head
mika 4 years ago committed by xujie
parent 088006169e
commit 3619e434df

@ -259,6 +259,24 @@ public class ClientConnectionsEntry {
freeSubscribeConnectionsCounter.release();
}
public void closeAllConnections() {
synchronized (this) {
for (RedisConnection connection : this.getAllConnections()) {
if (!connection.isClosed()) {
connection.closeAsync();
}
}
this.getAllConnections().clear();
for (RedisConnection connection : this.getAllSubscribeConnections()) {
if (!connection.isClosed()) {
connection.closeAsync();
}
}
this.getAllSubscribeConnections().clear();
}
}
@Override
public String toString() {
return "[freeSubscribeConnectionsAmount=" + freeSubscribeConnections.size()

@ -153,30 +153,16 @@ public class LoadBalancerManager {
private AtomicBoolean initConnError = new AtomicBoolean(false);
@Override
public void accept(Void r, Throwable ex) {
synchronized (this) {
if (ex == null) {
listener.decCounter();
} else {
if (!initConnError.compareAndSet(false, true)) {
return;
}
for (RedisConnection connection : entry.getAllConnections()) {
if (!connection.isClosed()) {
connection.closeAsync();
}
}
entry.getAllConnections().clear();
for (RedisConnection connection : entry.getAllSubscribeConnections()) {
if (!connection.isClosed()) {
connection.closeAsync();
}
}
entry.getAllSubscribeConnections().clear();
entry.closeAllConnections();
entry.setInitialized(false);
}
}
}
};
entry.resetFirstFail();
slaveConnectionPool.initConnections(entry).onComplete(initCallBack);

@ -132,19 +132,7 @@ abstract class ConnectionPool<T extends RedisConnection> {
return;
}
for (RedisConnection connection : entry.getAllConnections()) {
if (!connection.isClosed()) {
connection.closeAsync();
}
}
entry.getAllConnections().clear();
for (RedisConnection connection : entry.getAllSubscribeConnections()) {
if (!connection.isClosed()) {
connection.closeAsync();
}
}
entry.getAllSubscribeConnections().clear();
entry.closeAllConnections();
int totalInitializedConnections = minimumIdleSize - initializedConnections.get();
String errorMsg;

Loading…
Cancel
Save