use of org.redisson.connection.ClientConnectionsEntry in project redisson by redisson.
the class LoadBalancerManager method getConnection.
public RFuture<RedisConnection> getConnection(RedisCommand<?> command, InetSocketAddress addr) {
ClientConnectionsEntry entry = addr2Entry.get(addr);
if (entry != null) {
return slaveConnectionPool.get(command, entry);
}
RedisConnectionException exception = new RedisConnectionException("Can't find entry for " + addr);
return connectionManager.newFailedFuture(exception);
}
use of org.redisson.connection.ClientConnectionsEntry in project redisson by redisson.
the class LoadBalancerManager method returnPubSubConnection.
public void returnPubSubConnection(RedisPubSubConnection connection) {
ClientConnectionsEntry entry = addr2Entry.get(connection.getRedisClient().getAddr());
pubSubConnectionPool.returnConnection(entry, connection);
}
use of org.redisson.connection.ClientConnectionsEntry in project redisson by redisson.
the class LoadBalancerManager method returnConnection.
public void returnConnection(RedisConnection connection) {
ClientConnectionsEntry entry = addr2Entry.get(connection.getRedisClient().getAddr());
slaveConnectionPool.returnConnection(entry, connection);
}
use of org.redisson.connection.ClientConnectionsEntry in project redisson by redisson.
the class LoadBalancerManager method unfreeze.
public boolean unfreeze(String host, int port, FreezeReason freezeReason) {
InetSocketAddress addr = new InetSocketAddress(host, port);
ClientConnectionsEntry entry = addr2Entry.get(addr);
if (entry == null) {
throw new IllegalStateException("Can't find " + addr + " in slaves!");
}
synchronized (entry) {
if (!entry.isFreezed()) {
return false;
}
if ((freezeReason == FreezeReason.RECONNECT && entry.getFreezeReason() == FreezeReason.RECONNECT) || freezeReason != FreezeReason.RECONNECT) {
entry.resetFailedAttempts();
entry.setFreezed(false);
entry.setFreezeReason(null);
return true;
}
}
return false;
}
use of org.redisson.connection.ClientConnectionsEntry in project redisson by redisson.
the class LoadBalancerManager method freeze.
public ClientConnectionsEntry freeze(String host, int port, FreezeReason freezeReason) {
InetSocketAddress addr = new InetSocketAddress(host, port);
ClientConnectionsEntry connectionEntry = addr2Entry.get(addr);
return freeze(connectionEntry, freezeReason);
}
Aggregations