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

@@ -24,7 +24,7 @@ public abstract class Pool<T> {
if (this.internalPool != null) {
try {
destroy();
closeInternalPool();
} catch (Exception e) {
}
}
@@ -58,7 +58,11 @@ public abstract class Pool<T> {
public void returnResource(final T resource) {
returnResourceObject(resource);
}
public void destroy() {
closeInternalPool();
}
protected void returnBrokenResourceObject(final Object resource) {
try {
internalPool.invalidateObject(resource);
@@ -68,8 +72,8 @@ public abstract class Pool<T> {
}
}
public void destroy() {
try {
protected void closeInternalPool() {
try {
internalPool.close();
} catch (Exception e) {
throw new JedisException("Could not destroy the pool", e);