OuterClientServiceProcessor implements HealthEventProcessor { @Override public void onEvent(AbstractInstanceEvent instanceEvent) { RedisInstanceInfo info = instanceEvent.getInstance().getRedisInstanceInfo(); if(!instanceInBackupDc(info.getHostPort())) { logger.info("[onEvent][instance not in backupDc] {}, {}", instanceEvent.getClass().getSimpleName(), info); return; } for(HealthEventHandler handler : eventHandlers) { try { handler.handle(instanceEvent); } catch (Exception e) { logger.error("[tryHandle] instance event: {}, instance: {}", instanceEvent.getClass().getSimpleName(), instanceEvent.getInstance().getEndpoint(), e); } } }  @Override void onEvent(AbstractInstanceEvent instanceEvent); @VisibleForTesting OuterClientServiceProcessor setEventHandlers(List<HealthEventHandler> eventHandlers);  }
@Test public void testOnEventConfiguredNotMarkDown() throws HealthEventProcessorException { when(consoleConfig.getDelayedMarkDownDcClusters()).thenReturn( Sets.newHashSet(new DcClusterDelayMarkDown().setDcId(dc).setClusterId(cluster))); when(metaCache.inBackupDc(hostPort)).thenReturn(true); when(checker.isSiteHealthy(any())).thenReturn(true); processor.onEvent(new InstanceSick(instance)); verify(alertManager, atLeastOnce()).alert(instance.getRedisInstanceInfo(), ALERT_TYPE.INSTANCE_SICK_BUT_DELAY_MARK_DOWN, dc); }