Source:
<code>public Map<String, StoppableCheck> batchGetInstancesStoppableChecks(String clusterId, List<String> instances, String jsonContent) throws IOException { Map<String, StoppableCheck> finalStoppableChecks = new HashMap<>(); <START> Map<String, Future<StoppableCheck>> helixInstanceChecks = instances.stream() <END> .collect(Collectors.toMap(Function.identity(), instance -> POOL.submit(() -> performHelixOwnInstanceCheck(clusterId, instance)))); List<String> instancesForCustomInstanceLevelChecks = filterInstancesForNextCheck(helixInstanceChecks, finalStoppableChecks); if (instancesForCustomInstanceLevelChecks.isEmpty()) { return finalStoppableChecks; } RESTConfig restConfig = _configAccessor.getRESTConfig(clusterId); if (restConfig == null) { LOG.error("The cluster hasn't enabled client side health checks yet", clusterId); return finalStoppableChecks; } Map<String, String> customPayLoads = getCustomPayLoads(jsonContent); Map<String, Future<StoppableCheck>> customInstanceLevelChecks = instancesForCustomInstanceLevelChecks.stream() .collect(Collectors.toMap(Function.identity(), instance -> POOL.submit( () -> performCustomInstanceCheck(clusterId, instance, getBaseUrl(instance, restConfig), customPayLoads)))); List<String> instancesForCustomPartitionLevelChecks = filterInstancesForNextCheck(customInstanceLevelChecks, finalStoppableChecks); if (!instancesForCustomPartitionLevelChecks.isEmpty()) { Map<String, StoppableCheck> instancePartitionLevelChecks = performPartitionsCheck(instancesForCustomPartitionLevelChecks, restConfig, customPayLoads); for (Map.Entry<String, StoppableCheck> instancePartitionStoppableCheckEntry : instancePartitionLevelChecks.entrySet()) { finalStoppableChecks.put(instancePartitionStoppableCheckEntry.getKey(), instancePartitionStoppableCheckEntry.getValue()); } } return finalStoppableChecks; }</code><technical_language>I need add instances keys finalStoppableChecks. Otherwise, return empty map RESTConfig is setup. stoppable instances is checked final mapping. change top level result preparing change logic here</technical_language>

Target:
public Map<String, StoppableCheck> batchGetInstancesStoppableChecks(String clusterId, List<String> instances, String jsonContent) throws IOException { Map<String, StoppableCheck> finalStoppableChecks = new HashMap<>(); Map<String, Future<StoppableCheck>> helixInstanceChecks = instances.stream().collect(Collectors.toMap(Function.identity(), instance -> POOL.submit(() -> performHelixOwnInstanceCheck(clusterId, instance)))); List<String> instancesForCustomInstanceLevelChecks = filterInstancesForNextCheck(helixInstanceChecks, finalStoppableChecks); if (instancesForCustomInstanceLevelChecks.isEmpty()) { return finalStoppableChecks; } RESTConfig restConfig = _configAccessor.getRESTConfig(clusterId); if (restConfig == null) { String errorMessage = String.format("The cluster %s hasn't enabled client side health checks yet, " + "thus the stoppable check result is inaccurate", clusterId); LOG.error(errorMessage); throw new HelixException(errorMessage); } Map<String, String> customPayLoads = getCustomPayLoads(jsonContent); Map<String, Future<StoppableCheck>> customInstanceLevelChecks = instancesForCustomInstanceLevelChecks.stream() .collect(Collectors.toMap(Function.identity(), instance -> POOL.submit(() -> performCustomInstanceCheck(clusterId, instance, getBaseUrl(instance, restConfig), customPayLoads)))); List<String> instancesForCustomPartitionLevelChecks = filterInstancesForNextCheck(customInstanceLevelChecks, finalStoppableChecks); if (!instancesForCustomPartitionLevelChecks.isEmpty()) { Map<String, StoppableCheck> instancePartitionLevelChecks = performPartitionsCheck( instancesForCustomPartitionLevelChecks, restConfig, customPayLoads); for (Map.Entry<String, StoppableCheck> instancePartitionStoppableCheckEntry : instancePartitionLevelChecks .entrySet()) { finalStoppableChecks.put(instancePartitionStoppableCheckEntry.getKey(), instancePartitionStoppableCheckEntry.getValue()); } } return finalStoppableChecks; }