|
|
@ -29,7 +29,6 @@ import org.redisson.client.RedisConnectionException;
|
|
|
|
import org.redisson.client.protocol.RedisCommand;
|
|
|
|
import org.redisson.client.protocol.RedisCommand;
|
|
|
|
import org.redisson.client.protocol.RedisCommands;
|
|
|
|
import org.redisson.client.protocol.RedisCommands;
|
|
|
|
import org.redisson.config.MasterSlaveServersConfig;
|
|
|
|
import org.redisson.config.MasterSlaveServersConfig;
|
|
|
|
import org.redisson.config.ReadMode;
|
|
|
|
|
|
|
|
import org.redisson.connection.ClientConnectionsEntry;
|
|
|
|
import org.redisson.connection.ClientConnectionsEntry;
|
|
|
|
import org.redisson.connection.ClientConnectionsEntry.FreezeReason;
|
|
|
|
import org.redisson.connection.ClientConnectionsEntry.FreezeReason;
|
|
|
|
import org.redisson.connection.ConnectionManager;
|
|
|
|
import org.redisson.connection.ConnectionManager;
|
|
|
@ -168,8 +167,7 @@ abstract class ConnectionPool<T extends RedisConnection> {
|
|
|
|
List<ClientConnectionsEntry> entriesCopy = new LinkedList<ClientConnectionsEntry>(entries);
|
|
|
|
List<ClientConnectionsEntry> entriesCopy = new LinkedList<ClientConnectionsEntry>(entries);
|
|
|
|
while (!entriesCopy.isEmpty()) {
|
|
|
|
while (!entriesCopy.isEmpty()) {
|
|
|
|
ClientConnectionsEntry entry = config.getLoadBalancer().getEntry(entriesCopy);
|
|
|
|
ClientConnectionsEntry entry = config.getLoadBalancer().getEntry(entriesCopy);
|
|
|
|
if ((!entry.isFreezed() ||
|
|
|
|
if ((!entry.isFreezed() || entry.isMasterForRead()) &&
|
|
|
|
(entry.getFreezeReason() == FreezeReason.SYSTEM && config.getReadMode() == ReadMode.MASTER_SLAVE)) &&
|
|
|
|
|
|
|
|
tryAcquireConnection(entry)) {
|
|
|
|
tryAcquireConnection(entry)) {
|
|
|
|
return acquireConnection(command, entry);
|
|
|
|
return acquireConnection(command, entry);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -421,7 +419,7 @@ abstract class ConnectionPool<T extends RedisConnection> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void returnConnection(ClientConnectionsEntry entry, T connection) {
|
|
|
|
public void returnConnection(ClientConnectionsEntry entry, T connection) {
|
|
|
|
if (entry.isFreezed()) {
|
|
|
|
if (entry.isFreezed() && !entry.isMasterForRead()) {
|
|
|
|
connection.closeAsync();
|
|
|
|
connection.closeAsync();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
releaseConnection(entry, connection);
|
|
|
|
releaseConnection(entry, connection);
|
|
|
|