use of com.ctrip.xpipe.redis.core.protocal.pojo.Sentinel in project x-pipe by ctripcorp.
the class DefaultSentinelManager method removeSentinel.
@Override
public void removeSentinel(String clusterId, String shardId, ExecutionLog executionLog) {
String sentinelMonitorName = dcMetaCache.getSentinelMonitorName(clusterId, shardId);
String allSentinels = dcMetaCache.getSentinel(clusterId, shardId).getAddress();
executionLog.info(String.format("removeSentinel cluster:%s, shard:%s, masterName:%s, sentinelAddress:%s", clusterId, shardId, sentinelMonitorName, allSentinels));
if (checkEmpty(sentinelMonitorName, allSentinels, executionLog)) {
return;
}
List<InetSocketAddress> sentinels = IpUtils.parse(allSentinels);
List<Sentinel> realSentinels = getRealSentinels(sentinels, sentinelMonitorName, executionLog);
if (realSentinels == null) {
executionLog.warn("get real sentinels null");
return;
}
executionLog.info(String.format("removeSentinel realSentinels:%s", realSentinels));
for (Sentinel sentinel : realSentinels) {
SimpleObjectPool<NettyClient> clientPool = keyedClientPool.getKeyPool(new InetSocketAddress(sentinel.getIp(), sentinel.getPort()));
SentinelRemove sentinelRemove = new SentinelRemove(clientPool, sentinelMonitorName, scheduled);
try {
String result = sentinelRemove.execute().get();
executionLog.info(String.format("removeSentinel %s from %s : %s", sentinelMonitorName, sentinel, result));
} catch (InterruptedException | ExecutionException e) {
executionLog.info(String.format("removeSentinel %s from %s : %s", sentinelMonitorName, sentinel, e.getMessage()));
logger.warn("[removeSentinel]" + sentinel, e);
}
}
}
Aggregations