Source:
<code>public List<ServerComponentHealth> getResponses(String componentType, String componentScope, String componentInputs, DiagnosticsAware component) { List<String> hosts = getLiveInstances(); ConcurrentMap<String, String> responses = new ConcurrentHashMap<>(); ConcurrentMap<String, String> errorResponses = new ConcurrentHashMap<>(); hosts.parallelStream().forEach(hostName -> { ServerComponentHealthRestClient restClient = null; try { String dmsUri = getDmsUri(hostName); LOG.info("Send restli status request to " + dmsUri); restClient = ServerComponentHealthRestClientFactory.getClient(dmsUri, Collections.singletonMap( HttpClientFactory.HTTP_REQUEST_TIMEOUT, HTTP_TIMEOUT)); ServerComponentHealth response = null; String errorMessage = ""; try { response = restClient.getStatus(componentType, componentScope, componentInputs); } catch (Exception e) { errorMessage = "Received REST exception: " + e.toString() + " from the host: " + dmsUri; LOG.error("Received REST exception from the host: {}", dmsUri, e); } finally { if (response == null && errorMessage.isEmpty()) { errorMessage = "Failed to receive REST response from the host: " + dmsUri; LOG.error(errorMessage); } if (!errorMessage.isEmpty()) { errorResponses.put(hostName, errorMessage); } else { String message = "Received REST response from the host: " + dmsUri + " with status: " + response.getStatus(); LOG.info(message); responses.put(hostName, response.getStatus()); } } } finally { if (restClient != null) { restClient.shutdown(); } } }); ServerComponentHealth serverComponentHealth = new ServerComponentHealth(); if (errorResponses.isEmpty()) { serverComponentHealth.setSucceeded(true); } else { serverComponentHealth.setSucceeded(false); } <START> String localhostName = ""; <END> try { localhostName = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException uhe) { LOG.error("Could not get localhost Name", uhe.getMessage()); } serverComponentHealth.setInstanceName(localhostName); serverComponentHealth.setErrorMessages(errorResponses.toString()); serverComponentHealth.setStatus(component.reduce(componentInputs, responses)); return Arrays.asList(serverComponentHealth); }</code><technical_language>"UNKNOWN" default</technical_language>

Target:
public List<ServerComponentHealth> getResponses(String componentType, String componentScope, String componentInputs, DiagnosticsAware component) { List<String> hosts = getLiveInstances(); Map<String, String> responses = new ConcurrentHashMap<>(); Map<String, String> errorResponses = new ConcurrentHashMap<>(); hosts.parallelStream().forEach(hostName -> { ServerComponentHealthRestClient restClient = null; try { String dmsUri = getDmsUri(hostName); LOG.info("Send restli status request to " + dmsUri); restClient = ServerComponentHealthRestClientFactory.getClient(dmsUri, Collections.singletonMap( HttpClientFactory.HTTP_REQUEST_TIMEOUT, HTTP_TIMEOUT)); ServerComponentHealth response = null; String errorMessage = ""; try { response = restClient.getStatus(componentType, componentScope, componentInputs); } catch (Exception e) { errorMessage = "Received REST exception: " + e.toString() + " from the host: " + dmsUri; LOG.error("Received REST exception from the host: {}", dmsUri, e); } finally { if (response == null && errorMessage.isEmpty()) { errorMessage = "Failed to receive REST response from the host: " + dmsUri; LOG.error(errorMessage); } if (!errorMessage.isEmpty()) { errorResponses.put(hostName, errorMessage); } else { String message = "Received REST response from the host: " + dmsUri + " with status: " + response.getStatus(); LOG.info(message); responses.put(hostName, response.getStatus()); } } } finally { if (restClient != null) { restClient.shutdown(); } } }); ServerComponentHealth serverComponentHealth = new ServerComponentHealth(); serverComponentHealth.setSucceeded(true); if (!errorResponses.isEmpty()) { serverComponentHealth.setSucceeded(false); } String localhostName = "UNKNOWN HOST"; try { localhostName = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException uhe) { LOG.error("Could not get localhost Name", uhe.getMessage()); } serverComponentHealth.setInstanceName(localhostName); serverComponentHealth.setErrorMessages(errorResponses.toString()); try { String status = component.reduce(componentInputs, responses); serverComponentHealth.setStatus(status); } catch (Exception e) { serverComponentHealth.setSucceeded(false); serverComponentHealth.setStatus(""); } return Arrays.asList(serverComponentHealth); }