diff --git a/src/main/java/redis/clients/jedis/JedisSentinelPool.java b/src/main/java/redis/clients/jedis/JedisSentinelPool.java index f10f0e6154..9577d47efd 100644 --- a/src/main/java/redis/clients/jedis/JedisSentinelPool.java +++ b/src/main/java/redis/clients/jedis/JedisSentinelPool.java @@ -300,14 +300,19 @@ public void run() { running.set(true); while (running.get()) { - - j = new Jedis(host, port); - try { // double check that it is not being shutdown if (!running.get()) { break; } + + j = new Jedis(host, port, sentinelConnectionTimeout, sentinelSoTimeout); + if (sentinelPassword != null) { + j.auth(sentinelPassword); + } + if (sentinelClientName != null) { + j.clientSetname(sentinelClientName); + } // code for active refresh List masterAddr = j.sentinelGetMasterAddrByName(masterName); @@ -356,7 +361,9 @@ public void onMessage(String channel, String message) { log.debug("Unsubscribing from Sentinel at {}:{}", host, port); } } finally { - j.close(); + if (j != null) { + j.close(); + } } } }