/** * Execute against a cluster at a specific endpoint. */ private boolean run(final Namespace options, final Target target, final PrintStream out, final PrintStream err, final String username, final boolean json, final BufferedReader stdin) throws Exception { final HeliosClient client = Utils.getClient(target, err, username, options); if (client == null) { return false; } try { final int result = run(options, client, out, json, stdin); return result == 0; } catch (ExecutionException e) { final Throwable cause = e.getCause(); // if target is a domain, print message like // "Request timed out to master in ash.spotify.net (http://ash2-helios-a4.ash2.spotify.net)", // otherwise "Request timed out to master http://ash2-helios-a4.ash2.spotify.net:5800" if (cause instanceof TimeoutException) { err.println("Request timed out to master in " + target); } else { throw new RuntimeException(cause); } return false; } finally { client.close(); } }
final boolean successful = run(options, target, out, err, username, json, stdin); if (shortCircuit && !successful) { return 1;
/** * Execute against a cluster at a specific endpoint * @param stdin TODO */ private boolean run(final Namespace options, final Target target, final PrintStream out, final PrintStream err, final String username, final boolean json, final BufferedReader stdin) throws InterruptedException, IOException { final HeliosClient client = Utils.getClient(target, err, username); if (client == null) { return false; } try { final int result = run(options, client, out, json, stdin); return result == 0; } catch (ExecutionException e) { final Throwable cause = e.getCause(); // if target is a domain, print message like // "Request timed out to master in ash.spotify.net (http://ash2-helios-a4.ash2.spotify.net)", // otherwise "Request timed out to master http://ash2-helios-a4.ash2.spotify.net:5800" if (cause instanceof TimeoutException) { err.println("Request timed out to master in " + target); } else { throw Throwables.propagate(cause); } return false; } finally { client.close(); } }
final boolean successful = run(options, target, out, err, username, json, stdin); if (shortCircuit && !successful) { return 1;