use of com.ctrip.xpipe.redis.core.protocal.cmd.AbstractSentinelCommand.Sentinels in project x-pipe by ctripcorp.
the class DefaultSentinelManager method getRealSentinels.
private List<Sentinel> getRealSentinels(List<InetSocketAddress> sentinels, String sentinelMonitorName, ExecutionLog executionLog) {
List<Sentinel> realSentinels = null;
for (InetSocketAddress sentinelAddress : sentinels) {
SimpleObjectPool<NettyClient> clientPool = keyedClientPool.getKeyPool(sentinelAddress);
Sentinels sentinelsCommand = new Sentinels(clientPool, sentinelMonitorName, scheduled);
try {
realSentinels = sentinelsCommand.execute().get();
executionLog.info(String.format("get sentinels from %s : %s", sentinelAddress, realSentinels));
if (realSentinels.size() > 0) {
realSentinels.add(new Sentinel(sentinelAddress.toString(), sentinelAddress.getHostString(), sentinelAddress.getPort()));
break;
}
} catch (InterruptedException | ExecutionException e) {
logger.warn("[getRealSentinels]get sentinels from " + sentinelAddress, e);
executionLog.warn("[getRealSentinels]get sentinels from " + sentinelAddress + "," + e.getMessage());
}
}
return realSentinels;
}
Aggregations