Let the user choose whether to testOnBorrow or testOnReturn
Force testOnBorrow if neither is specified.
This commit is contained in:
@@ -65,8 +65,10 @@ public class JedisSentinelPool extends Pool<Jedis> {
|
|||||||
public JedisSentinelPool(String masterName, Set<String> sentinels,
|
public JedisSentinelPool(String masterName, Set<String> sentinels,
|
||||||
final GenericObjectPoolConfig poolConfig, int timeout,
|
final GenericObjectPoolConfig poolConfig, int timeout,
|
||||||
final String password, final int database) {
|
final String password, final int database) {
|
||||||
// Proper master failover detection dependes on testOnBorrow, so force it here
|
// Proper master failover detection dependes on testOnBorrow or testOnReturn, so force it here
|
||||||
poolConfig.setTestOnBorrow(true);
|
if (!poolConfig.getTestOnBorrow() && !poolConfig.getTestOnReturn()) {
|
||||||
|
poolConfig.setTestOnBorrow(true);
|
||||||
|
}
|
||||||
|
|
||||||
this.poolConfig = poolConfig;
|
this.poolConfig = poolConfig;
|
||||||
this.timeout = timeout;
|
this.timeout = timeout;
|
||||||
|
|||||||
Reference in New Issue
Block a user