CrossMasterDelayService implements DelayActionListener, BiDirectionSupport { @Override public void stopWatch(HealthCheckAction action) { RedisHealthCheckInstance instance = action.getActionInstance(); RedisInstanceInfo info = instance.getRedisInstanceInfo(); DcClusterShard key = new DcClusterShard(currentDcId, info.getClusterId(), info.getShardId()); if (currentDcId.equalsIgnoreCase(info.getDcId())) { crossMasterDelays.remove(key); } else if (crossMasterDelays.containsKey(key)) { crossMasterDelays.get(key).remove(info.getDcId()); } }  @Override void onAction(DelayActionContext context); @Override void stopWatch(HealthCheckAction action); Map<String, Pair<HostPort, Long>> getPeerMasterDelayFromCurrentDc(String clusterId, String shardId); Map<String, Pair<HostPort, Long>> getPeerMasterDelayFromSourceDc(String sourceDcId, String clusterId, String shardId); Map<String, Pair<HostPort, Long>> getPeerMasterDelayFromSourceDc(ClusterType clusterType, String sourceDcId, String clusterId, String shardId); UnhealthyInfoModel getCurrentDcUnhealthyMasters();  }
@Test public void testStopWatch() { testOnAction(); service.stopWatch(action); Assert.assertEquals(Collections.EMPTY_MAP, service.getPeerMasterDelayFromCurrentDc(clusterId, shardId)); Mockito.when(instance.getRedisInstanceInfo()).thenReturn(new DefaultRedisInstanceInfo(dcId, clusterId, shardId, new HostPort(), null, ClusterType.BI_DIRECTION)); service.stopWatch(action); Assert.assertEquals(null, service.getPeerMasterDelayFromCurrentDc(clusterId, shardId)); }