@Test public void testOnActionWithException() { SentinelActionContext context = new SentinelActionContext(instance, new Exception()); collector.onAction(context); Mockito.verify(sentinelHelloCollector, Mockito.never()).onAction(Mockito.any()); }
@Override public void onAction(SentinelActionContext context) { RedisInstanceInfo info = context.instance().getRedisInstanceInfo(); if (!info.getClusterId().equalsIgnoreCase(clusterId) || !info.getShardId().equalsIgnoreCase(shardId)) return; collectHello(context); if (checkFinishedInstance.size() >= getRedisCntInCurrentDc() - 1) { if (checkFinishedInstance.size() == checkFailInstance.size()) { logger.info("[{}-{}][onAction] sentinel hello all fail, skip sentinel adjust", clusterId, shardId); resetCheckResult(); return; } logger.debug("[{}-{}][onAction] sentinel hello collect finish", clusterId, shardId); handleAllHello(context.instance()); } }
CurrentDcSentinelHelloAggregationCollector extends AbstractAggregationCollector<CurrentDcSentinelHelloCollector> implements BiDirectionSupport { @Override public void onAction(SentinelActionContext context) { RedisInstanceInfo info = context.instance().getRedisInstanceInfo(); if (!info.getClusterId().equalsIgnoreCase(clusterId) || !info.getShardId().equalsIgnoreCase(shardId)) return; collectHello(context); if (checkFinishedInstance.size() >= getRedisCntInCurrentDc() - 1) { if (checkFinishedInstance.size() == checkFailInstance.size()) { logger.info("[{}-{}][onAction] sentinel hello all fail, skip sentinel adjust", clusterId, shardId); resetCheckResult(); return; } logger.debug("[{}-{}][onAction] sentinel hello collect finish", clusterId, shardId); handleAllHello(context.instance()); } } }
CurrentDcSentinelHelloAggregationCollector extends AbstractAggregationCollector<CurrentDcSentinelHelloCollector> implements BiDirectionSupport { @Override public void onAction(SentinelActionContext context) { RedisInstanceInfo info = context.instance().getRedisInstanceInfo(); if (!info.getClusterId().equalsIgnoreCase(clusterId) || !info.getShardId().equalsIgnoreCase(shardId)) return; collectHello(context); if (checkFinishedInstance.size() >= getRedisCntInCurrentDc() - 1) { if (checkFinishedInstance.size() == checkFailInstance.size()) { logger.info("[{}-{}][onAction] sentinel hello all fail, skip sentinel adjust", clusterId, shardId); resetCheckResult(); return; } logger.debug("[{}-{}][onAction] sentinel hello collect finish", clusterId, shardId); handleAllHello(context.instance()); } } CurrentDcSentinelHelloAggregationCollector(MetaCache metaCache, CurrentDcSentinelHelloCollector sentinelHelloCollector,
                                                      String clusterId, String shardId); }
CurrentDcSentinelHelloAggregationCollector extends AbstractAggregationCollector<CurrentDcSentinelHelloCollector> implements BiDirectionSupport { @Override public void onAction(SentinelActionContext context) { RedisInstanceInfo info = context.instance().getRedisInstanceInfo(); if (!info.getClusterId().equalsIgnoreCase(clusterId) || !info.getShardId().equalsIgnoreCase(shardId)) return; collectHello(context); if (checkFinishedInstance.size() >= getRedisCntInCurrentDc() - 1) { if (checkFinishedInstance.size() == checkFailInstance.size()) { logger.info("[{}-{}][onAction] sentinel hello all fail, skip sentinel adjust", clusterId, shardId); resetCheckResult(); return; } logger.debug("[{}-{}][onAction] sentinel hello collect finish", clusterId, shardId); handleAllHello(context.instance()); } } CurrentDcSentinelHelloAggregationCollector(MetaCache metaCache, CurrentDcSentinelHelloCollector sentinelHelloCollector,
                                                      String clusterId, String shardId); @Override void onAction(SentinelActionContext context); }
CurrentDcSentinelHelloAggregationCollector extends AbstractAggregationCollector<CurrentDcSentinelHelloCollector> implements BiDirectionSupport { @Override public void onAction(SentinelActionContext context) { RedisInstanceInfo info = context.instance().getRedisInstanceInfo(); if (!info.getClusterId().equalsIgnoreCase(clusterId) || !info.getShardId().equalsIgnoreCase(shardId)) return; collectHello(context); if (checkFinishedInstance.size() >= getRedisCntInCurrentDc() - 1) { if (checkFinishedInstance.size() == checkFailInstance.size()) { logger.info("[{}-{}][onAction] sentinel hello all fail, skip sentinel adjust", clusterId, shardId); resetCheckResult(); return; } logger.debug("[{}-{}][onAction] sentinel hello collect finish", clusterId, shardId); handleAllHello(context.instance()); } } CurrentDcSentinelHelloAggregationCollector(MetaCache metaCache, CurrentDcSentinelHelloCollector sentinelHelloCollector,
                                                      String clusterId, String shardId); @Override void onAction(SentinelActionContext context);  }