Merge branch 'sentinel_config_err_handling' of https://github.com/wizwjw/jedis into wizwjw-sentinel_config_err_handling
Conflicts: src/main/java/redis/clients/jedis/JedisSentinelPool.java src/test/java/redis/clients/jedis/tests/JedisSentinelPoolTest.java
This commit is contained in:
@@ -130,8 +130,15 @@ public class JedisSentinelPool extends Pool<Jedis> {
|
||||
jedis = new Jedis(hap.getHost(), hap.getPort());
|
||||
|
||||
if (master == null) {
|
||||
master = toHostAndPort(jedis
|
||||
.sentinelGetMasterAddrByName(masterName));
|
||||
List<String> masterAddr = jedis
|
||||
.sentinelGetMasterAddrByName(masterName);
|
||||
if (masterAddr == null || masterAddr.size() != 2) {
|
||||
log.warning("Can not get master addr, master name: "
|
||||
+ masterName + ". Sentinel: " + hap + ".");
|
||||
continue;
|
||||
}
|
||||
|
||||
master = toHostAndPort(masterAddr);
|
||||
log.fine("Found Redis master at " + master);
|
||||
break outer;
|
||||
}
|
||||
@@ -140,7 +147,7 @@ public class JedisSentinelPool extends Pool<Jedis> {
|
||||
+ ". Trying next one.");
|
||||
} finally {
|
||||
if (jedis != null) {
|
||||
jedis.close();
|
||||
jedis.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -331,4 +338,4 @@ public class JedisSentinelPool extends Pool<Jedis> {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user