Source:
<code>protected String verifyAndWriteCatalogJar(CatalogChangeResult ccr) { String procedureName = "@VerifyCatalogAndWriteJar"; String diffCommands = CompressionService.decodeBase64AndDecompress(ccr.encodedDiffCommands); CompletableFuture<Map<Integer,ClientResponse>> cf = callNTProcedureOnAllHosts(procedureName, ccr.catalogBytes, diffCommands, ccr.catalogHash, ccr.deploymentBytes); Map<Integer, ClientResponse> resultMapByHost = null; String err; long timeoutSeconds = VerifyCatalogAndWriteJar.TIMEOUT; hostLog.info("Max timeout setting for VerifyCatalogAndWriteJar is " + timeoutSeconds + " seconds"); try { Stopwatch sw = Stopwatch.createStarted(); long elapsed = 0; while ((elapsed = sw.elapsed(TimeUnit.SECONDS)) < (timeoutSeconds)) { resultMapByHost = cf.getNow(null); if (resultMapByHost != null) { sw.stop(); break; } if (elapsed < 5) { <START> Thread.sleep(TimeUnit.MILLISECONDS.toMillis(100)); <END> continue; } hostLog.info(elapsed + " seconds has elapsed but " + procedureName + " is still wait for remote response." + "The max timeout value is " + timeoutSeconds + " seconds."); Thread.sleep(TimeUnit.SECONDS.toMillis(5)); } } catch (Exception e) { e.printStackTrace(); err = procedureName + " run everywhere call failed: " + e.getMessage(); hostLog.info(err + ", " + com.google.common.base.Throwables.getStackTraceAsString(e)); return err; } if (resultMapByHost == null) { err = "An invocation of procedure " + procedureName + " on all hosts returned null result or time out."; hostLog.info(err); return err; } for (Entry<Integer, ClientResponse> entry : resultMapByHost.entrySet()) { if (entry.getValue().getStatus() != ClientResponseImpl.SUCCESS) { err = "The response from host " + entry.getKey().toString() + " for " + procedureName + " returned failures: " + entry.getValue().getStatusString(); compilerLog.info(err); return err; } } return null; }</code><technical_language>100 directly</technical_language>

Target:
protected String verifyAndWriteCatalogJar(CatalogChangeResult ccr) { String procedureName = "@VerifyCatalogAndWriteJar"; String diffCommands = CompressionService.decodeBase64AndDecompress(ccr.encodedDiffCommands); CompletableFuture<Map<Integer,ClientResponse>> cf = callNTProcedureOnAllHosts(procedureName, ccr.catalogBytes, diffCommands, ccr.catalogHash, ccr.deploymentBytes); Map<Integer, ClientResponse> resultMapByHost = null; String err; long timeoutSeconds = VerifyCatalogAndWriteJar.TIMEOUT; hostLog.info("Max timeout setting for VerifyCatalogAndWriteJar is " + timeoutSeconds + " seconds"); try { Stopwatch sw = Stopwatch.createStarted(); long elapsed = 0; while ((elapsed = sw.elapsed(TimeUnit.SECONDS)) < (timeoutSeconds)) { resultMapByHost = cf.getNow(null); if (resultMapByHost != null) { sw.stop(); break; } if (elapsed < 5) { Thread.sleep(100); continue; } hostLog.info(elapsed + " seconds has elapsed but " + procedureName + " is still wait for remote response." + "The max timeout value is " + timeoutSeconds + " seconds."); Thread.sleep(TimeUnit.SECONDS.toMillis(5)); } } catch (Exception e) { err = procedureName + " run everywhere call failed: " + e.getMessage(); hostLog.info(err + ", " + com.google.common.base.Throwables.getStackTraceAsString(e)); return err; } if (resultMapByHost == null) { err = "An invocation of procedure " + procedureName + " on all hosts timed out."; hostLog.info(err); return err; } for (Entry<Integer, ClientResponse> entry : resultMapByHost.entrySet()) { if (entry.getValue().getStatus() != ClientResponseImpl.SUCCESS) { err = "The response from host " + entry.getKey().toString() + " for " + procedureName + " returned failures: " + entry.getValue().getStatusString(); compilerLog.info(err); return err; } } return null; }