RepairRunner implements Runnable { static int getPossibleParallelRepairsCount( Map<List<String>, List<String>> ranges, Map<String, String> hostsInRing, DatacenterAvailability datacenterAvailability) throws ReaperException { if (ranges.isEmpty()) { String msg = "Repairing 0-sized cluster."; LOG.error(msg); throw new ReaperException(msg); } if (DatacenterAvailability.SIDECAR == datacenterAvailability) { return 1; } LOG.debug( "Possible parallel repairs : {}", Math.min( ranges.size() / ranges.values().iterator().next().size(), Math.max(1, hostsInRing.keySet().size() / ranges.values().iterator().next().size()))); return Math.min( ranges.size() / ranges.values().iterator().next().size(), Math.max(1, hostsInRing.keySet().size() / ranges.values().iterator().next().size())); } private  RepairRunner(
      AppContext context,
      UUID repairRunId,
      ClusterFacade clusterFacade); static RepairRunner create(
      AppContext context,
      UUID repairRunId,
      ClusterFacade clusterFacade); @Override void run();  }
@Test public void getPossibleParallelRepairsTest() throws Exception { Map<List<String>, List<String>> map = RepairRunnerTest.threeNodeCluster(); Map<String, String> endpointsThreeNodes = RepairRunnerTest.threeNodeClusterEndpoint(); assertEquals(1, RepairRunner.getPossibleParallelRepairsCount(map, endpointsThreeNodes, DatacenterAvailability.ALL)); map = RepairRunnerTest.sixNodeCluster(); Map<String, String> endpointsSixNodes = RepairRunnerTest.sixNodeClusterEndpoint(); assertEquals(2, RepairRunner.getPossibleParallelRepairsCount(map, endpointsSixNodes, DatacenterAvailability.ALL)); assertEquals(1, RepairRunner.getPossibleParallelRepairsCount(map, endpointsSixNodes, DatacenterAvailability.SIDECAR)); }