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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user