Source:
<code>private HostAndPort initSentinels(Set<String> sentinels, final String masterName) { HostAndPort master = null; boolean sentinelAvailable = false; log.info("Trying to find master from available Sentinels..."); for (String sentinel : sentinels) { final HostAndPort hap = HostAndPort.parseString(sentinel); log.debug("Connecting to Sentinel {}", hap); Jedis jedis = null; try { <START> jedis = new Jedis(hap.getHost(), hap.getPort(), sentinelConnectionTimeout, sentinelSoTimeout, sentinelPassword); <END> List<String> masterAddr = jedis.sentinelGetMasterAddrByName(masterName); sentinelAvailable = true; if (masterAddr == null || masterAddr.size() != 2) { log.warn("Can not get master addr, master name: {}. Sentinel: {}", masterName, hap); continue; } master = toHostAndPort(masterAddr); log.debug("Found Redis master at {}", master); break; } catch (JedisException e) { log.warn( "Cannot get master address from sentinel running @ {}. Reason: {}. Trying next one.", hap, e.toString()); } finally { if (jedis != null) { jedis.close(); } } } if (master == null) { if (sentinelAvailable) { throw new JedisException("Can connect to sentinel, but " + masterName + " seems to be not monitored..."); } else { throw new JedisConnectionException("All sentinels down, cannot determine where is " + masterName + " master is running..."); } } log.info("Redis master running at " + master + ", starting Sentinel listeners..."); for (String sentinel : sentinels) { final HostAndPort hap = HostAndPort.parseString(sentinel); MasterListener masterListener = new MasterListener(masterName, hap.getHost(), hap.getPort()); masterListener.setDaemon(true); masterListeners.add(masterListener); masterListener.start(); } return master; }</code><technical_language>sending password clientName in constructor, auth clientSetName done here</technical_language>

Target:
private HostAndPort initSentinels(Set<String> sentinels, final String masterName) { HostAndPort master = null; boolean sentinelAvailable = false; log.info("Trying to find master from available Sentinels..."); for (String sentinel : sentinels) { final HostAndPort hap = HostAndPort.parseString(sentinel); log.debug("Connecting to Sentinel {}", hap); Jedis jedis = null; try { jedis = new Jedis(hap.getHost(), hap.getPort(), sentinelConnectionTimeout, sentinelSoTimeout); if (sentinelPassword != null) { jedis.auth(sentinelPassword); } if (sentinelClientName != null) { jedis.clientSetname(sentinelClientName); } List<String> masterAddr = jedis.sentinelGetMasterAddrByName(masterName); sentinelAvailable = true; if (masterAddr == null || masterAddr.size() != 2) { log.warn("Can not get master addr, master name: {}. Sentinel: {}", masterName, hap); continue; } master = toHostAndPort(masterAddr); log.debug("Found Redis master at {}", master); break; } catch (JedisException e) { log.warn( "Cannot get master address from sentinel running @ {}. Reason: {}. Trying next one.", hap, e.toString()); } finally { if (jedis != null) { jedis.close(); } } } if (master == null) { if (sentinelAvailable) { throw new JedisException("Can connect to sentinel, but " + masterName + " seems to be not monitored..."); } else { throw new JedisConnectionException("All sentinels down, cannot determine where is " + masterName + " master is running..."); } } log.info("Redis master running at " + master + ", starting Sentinel listeners..."); for (String sentinel : sentinels) { final HostAndPort hap = HostAndPort.parseString(sentinel); MasterListener masterListener = new MasterListener(masterName, hap.getHost(), hap.getPort()); masterListener.setDaemon(true); masterListeners.add(masterListener); masterListener.start(); } return master; }