JedisSentinelPool now takes care of multi failover

* Now Pool.initPool() call closeInternalPool(), instead of destroy()
** calling destroy() in Pool.initPool() may have side effect, and JedisSentinelPool did
* modify unit test to test failover twice (needs +1 slave)
** modify configurations for additional slave
This commit is contained in:
Jungtaek Lim
2013-09-26 10:48:17 +09:00
parent 08e9b0c7e7
commit 35a2dfd4c0
5 changed files with 97 additions and 45 deletions

View File

@@ -33,18 +33,23 @@ public class HostAndPortUtil {
HostAndPort defaulthnp5 = new HostAndPort();
defaulthnp5.host = "localhost";
defaulthnp5.port = Protocol.DEFAULT_SENTINEL_PORT;
sentinelHostAndPortList.add(defaulthnp5);
defaulthnp5.port = Protocol.DEFAULT_PORT + 4;
redisHostAndPortList.add(defaulthnp5);
HostAndPort defaulthnp6 = new HostAndPort();
defaulthnp6.host = "localhost";
defaulthnp6.port = Protocol.DEFAULT_SENTINEL_PORT + 1;
defaulthnp6.port = Protocol.DEFAULT_SENTINEL_PORT;
sentinelHostAndPortList.add(defaulthnp6);
HostAndPort defaulthnp7 = new HostAndPort();
defaulthnp7.host = "localhost";
defaulthnp7.port = Protocol.DEFAULT_SENTINEL_PORT + 2;
defaulthnp7.port = Protocol.DEFAULT_SENTINEL_PORT + 1;
sentinelHostAndPortList.add(defaulthnp7);
HostAndPort defaulthnp8 = new HostAndPort();
defaulthnp8.host = "localhost";
defaulthnp8.port = Protocol.DEFAULT_SENTINEL_PORT + 2;
sentinelHostAndPortList.add(defaulthnp8);
String envRedisHosts = System.getProperty("redis-hosts");
String envSentinelHosts = System.getProperty("sentinel-hosts");