Merge pull request #303 from Kindrat/master

Failing ping request in case when server is unreachable instead of exception
pull/337/head
Nikita Koksharov 9 years ago
commit 5aa840938e

@ -15,16 +15,14 @@
*/
package org.redisson.connection;
import java.net.InetSocketAddress;
import java.util.Map;
import org.redisson.MasterSlaveServersConfig;
import io.netty.util.concurrent.Promise;
import org.redisson.client.RedisClient;
import org.redisson.client.RedisConnection;
import org.redisson.client.protocol.RedisCommands;
import org.redisson.core.ClusterNode;
import io.netty.util.concurrent.Promise;
import java.net.InetSocketAddress;
import java.util.Map;
public class RedisClientEntry implements ClusterNode {
@ -56,13 +54,16 @@ public class RedisClientEntry implements ClusterNode {
@Override
public boolean ping() {
RedisConnection c = connect();
RedisConnection c = null;
try {
c = connect();
return "PONG".equals(c.sync(RedisCommands.PING));
} catch (Exception e) {
return false;
} finally {
c.closeAsync();
if (c != null) {
c.closeAsync();
}
}
}

Loading…
Cancel
Save