DefaultSentinelManager implements SentinelManager { @Override public void removeShardSentinelMonitors(ShardEvent shardEvent) { ClusterType clusterType = shardEvent.getClusterType(); if (null != clusterType && clusterType.supportMultiActiveDC()) { return; } String clusterId = shardEvent.getClusterName(), shardId = shardEvent.getShardName(); String sentinelMonitorName = shardEvent.getShardMonitorName(); String allSentinels = shardEvent.getShardSentinels(); logger.info("[removeShardSentinelMonitors]removeSentinelMonitor cluster:{}, shard:{}, masterName:{}, sentinelAddress:{}", clusterId, shardId, sentinelMonitorName, allSentinels); if(checkEmpty(sentinelMonitorName, allSentinels)) { return; } List<InetSocketAddress> sentinels = IpUtils.parse(allSentinels); List<Sentinel> realSentinels = getRealSentinels(sentinels, sentinelMonitorName); if(realSentinels == null) { logger.warn("[removeShardSentinelMonitors]findRedisHealthCheckInstance real sentinels null"); return; } logger.info("[removeShardSentinelMonitors]removeSentinelMonitor realSentinels: {}", realSentinels); for(Sentinel sentinel : realSentinels) { removeSentinelMonitor(sentinel, sentinelMonitorName); } }  @Override void removeShardSentinelMonitors(ShardEvent shardEvent); @Override HostPort getMasterOfMonitor(Sentinel sentinel, String sentinelMonitorName); @Override void removeSentinelMonitor(Sentinel sentinel, String sentinelMonitorName); @Override String infoSentinel(Sentinel sentinel); @Override void monitorMaster(Sentinel sentinel, String sentinelMonitorName, HostPort master, int quorum); @Override List<HostPort> slaves(Sentinel sentinel, String sentinelMonitorName); @Override void reset(Sentinel sentinel, String sentinelMonitorName); @VisibleForTesting DefaultSentinelManager setScheduled(ScheduledExecutorService scheduled); @VisibleForTesting DefaultSentinelManager setKeyedClientPool(XpipeNettyClientKeyedObjectPool keyedClientPool);  }
@Test public void removeSentinels() throws Exception { ShardDeleteEvent shardEvent = new ShardDeleteEvent("cluster", "shard", Executors.newFixedThreadPool(2)); shardEvent.setShardSentinels("127.0.0.1:"+port); shardEvent.setShardMonitorName("sitemon-xpipegroup0"); manager.removeShardSentinelMonitors(shardEvent); }