JedisSentinelPool#return[Broken]Resource should handle nulls the same was as JedisPool
This commit is contained in:
@@ -80,6 +80,32 @@ public class JedisSentinelPoolTest extends JedisTestBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnResourceWithNullResource() {
|
||||
GenericObjectPoolConfig config = new GenericObjectPoolConfig();
|
||||
config.setMaxTotal(1);
|
||||
config.setBlockWhenExhausted(false);
|
||||
JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels,
|
||||
config, 1000, "foobared", 2);
|
||||
|
||||
Jedis nullJedis = null;
|
||||
pool.returnResource(nullJedis);
|
||||
pool.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void returnBrokenResourceWithNullResource() {
|
||||
GenericObjectPoolConfig config = new GenericObjectPoolConfig();
|
||||
config.setMaxTotal(1);
|
||||
config.setBlockWhenExhausted(false);
|
||||
JedisSentinelPool pool = new JedisSentinelPool(MASTER_NAME, sentinels,
|
||||
config, 1000, "foobared", 2);
|
||||
|
||||
Jedis nullJedis = null;
|
||||
pool.returnBrokenResource(nullJedis);
|
||||
pool.destroy();
|
||||
}
|
||||
|
||||
private void forceFailover(JedisSentinelPool pool)
|
||||
throws InterruptedException {
|
||||
HostAndPort oldMaster = pool.getCurrentHostMaster();
|
||||
|
||||
Reference in New Issue
Block a user