Added a JUnit test for JedisSentinelPool.

This test will set up and get a master from a Redis master slave pair being
watched by 2 Sentinels. It pings the master, segfaults it, asks the pool for
another connection and makes sure it can ping it.

This commit also restores the pom.xml file's scm information back to
xetorthio and adds the default Sentinel port to the Procotol.
This commit is contained in:
Hisham Mardam-Bey
2013-08-28 23:10:50 -04:00
parent e17679f568
commit 39d81d8f1f
7 changed files with 209 additions and 37 deletions

View File

@@ -231,9 +231,13 @@ public class JedisSentinelPool extends Pool<Jedis> {
}, "+switch-master");
} catch (JedisConnectionException e) {
log.severe("Lost connection to Sentinel at " + host + ":" + port + ". Sleeping 5000ms and retrying.");
try { Thread.sleep(subscribeRetryWaitTimeMillis); } catch (InterruptedException e1) { e1.printStackTrace(); }
if (running.get()) {
log.severe("Lost connection to Sentinel at " + host + ":" + port + ". Sleeping 5000ms and retrying.");
try { Thread.sleep(subscribeRetryWaitTimeMillis); } catch (InterruptedException e1) { e1.printStackTrace(); }
} else {
log.fine("Unsubscribing from Sentinel at " + host + ":" + port);
}
}
}
}

View File

@@ -13,6 +13,7 @@ import redis.clients.util.SafeEncoder;
public final class Protocol {
public static final int DEFAULT_PORT = 6379;
public static final int DEFAULT_SENTINEL_PORT = 26379;
public static final int DEFAULT_TIMEOUT = 2000;
public static final int DEFAULT_DATABASE = 0;