if (entry.isFreezed()
|| !entry.getConnectionsSemaphore().tryAcquire()) {
clientsCopy.remove(index);
} else {
RedisConnection conn = entry.getConnections().poll();
if (conn != null) {
return conn;
}
try {
conn = entry.getClient().connect(codec);
if (config.getPassword() != null) {
conn.auth(config.getPassword());
}
if (config.getDatabase() != 0) {
conn.select(config.getDatabase());
}
return conn;
} catch (RedisConnectionException e) {
entry.getConnectionsSemaphore().release();