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 = toHostAndPort(Arrays.asList(sentinel
		    .split(":")));

	    log.fine("Connecting to Sentinel " + hap);

	    Jedis jedis = null;
	    try {
		jedis = new Jedis(hap.getHost(), hap.getPort());

		List<String> masterAddr = jedis
			.sentinelGetMasterAddrByName(masterName);

		// connected to sentinel...
		sentinelAvailable = true;

		if (masterAddr == null || masterAddr.size() != 2) {
		    log.warning("Can not get master addr, master name: "
			    + masterName + ". Sentinel: " + hap + ".");
		    continue;
		}

		master = toHostAndPort(masterAddr);
		log.fine("Found Redis master at " + master);
		break;
	    } catch (JedisConnectionException e) {
		log.warning("Cannot connect to sentinel running @ " + hap
			+ ". Trying next one.");
	    } finally {
		if (jedis != null) {
		    jedis.close();
		}
	    }
	}

	if (master == null) {
	    if (sentinelAvailable) {
		// can connect to sentinel, but master name seems to not
		// monitored
		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 = toHostAndPort(Arrays.asList(sentinel
		    .split(":")));
	    MasterListener masterListener = new MasterListener(masterName,
		    hap.getHost(), hap.getPort());
	    masterListeners.add(masterListener);
	    masterListener.start();
	}

	return master;
    }