Threat connection failure as ping failure

pull/303/head
Kindrat 9 years ago
parent 3d507c4fec
commit d7b112ebfc

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

Loading…
Cancel
Save