public static boolean ping(final DockerClientExecutor dockerClientExecutor, final String containerId, final String command, int totalIterations, long sleep, TimeUnit timeUnit) { return ping(totalIterations, sleep, timeUnit, new PingCommand() { @Override public boolean call() { return execContainerPing(dockerClientExecutor, containerId, command); } }); }
public static boolean ping(final String host, final int port, int totalIterations, long sleep, TimeUnit timeUnit) { return ping(totalIterations, sleep, timeUnit, new PingCommand() { @Override public boolean call() { return ping(host, port); } }); }
public static boolean ping(final DockerClientExecutor dockerClientExecutor, final String containerId, final String command, int totalIterations, long sleep, TimeUnit timeUnit) { return ping(totalIterations, sleep, timeUnit, new PingCommand() { @Override public boolean call() { return execContainerPing(dockerClientExecutor, containerId, command); } }); }
public static boolean ping(final String host, final int port, int totalIterations, long sleep, TimeUnit timeUnit) { return ping(totalIterations, sleep, timeUnit, new PingCommand() { @Override public boolean call() { return ping(host, port); } }); }
@Override public boolean await() { for (Integer port : this.ports) { if (!Ping.ping(this.ip, port, this.pollIterations, this.getSleepTime(), this.getTimeUnit())) { return false; } } return true; }
@Override public boolean await() { for (Integer port : this.ports) { if (!Ping.ping(this.ip, port, this.pollIterations, this.getSleepTime(), this.getTimeUnit())) { return false; } } return true; }
private boolean executeHealthCheck(HealthCheck healthCheck) { final URL url = buildUrl(healthCheck); final int pollIterations = healthCheck.iterations(); final long sleepTime = Timespan.toMilliseconds(healthCheck.interval()); final int responseCode = healthCheck.responseCode(); final String method = healthCheck.method(); final Long connectTimeout = Timespan.toMilliseconds(healthCheck.timeout()); return Ping.ping(pollIterations, sleepTime, TimeUnit.MILLISECONDS, () -> { HttpURLConnection urlConnection = null; try { urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestMethod(method); urlConnection.setConnectTimeout(connectTimeout.intValue()); urlConnection.setReadTimeout(connectTimeout.intValue()); urlConnection.connect(); int connectionResponseCode = urlConnection.getResponseCode(); if (responseCode != connectionResponseCode) { return false; } } catch (IOException e) { return false; } finally { if (urlConnection != null) { urlConnection.disconnect(); } } return true; }); }
@Override public boolean await() { return Ping.ping(pollIterations, getSleepTime(), getTimeUnit(), new PingCommand() { @Override public boolean call() {
private boolean executeHealthCheck(HealthCheck healthCheck) { final URL url = buildUrl(healthCheck); final int pollIterations = healthCheck.iterations(); final long sleepTime = Timespan.toMilliseconds(healthCheck.interval()); final int responseCode = healthCheck.responseCode(); final String method = healthCheck.method(); final Long connectTimeout = Timespan.toMilliseconds(healthCheck.timeout()); return Ping.ping(pollIterations, sleepTime, TimeUnit.MILLISECONDS, () -> { HttpURLConnection urlConnection = null; try { urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestMethod(method); urlConnection.setConnectTimeout(connectTimeout.intValue()); urlConnection.setReadTimeout(connectTimeout.intValue()); urlConnection.connect(); int connectionResponseCode = urlConnection.getResponseCode(); if (responseCode != connectionResponseCode) { return false; } } catch (IOException e) { return false; } finally { if (urlConnection != null) { urlConnection.disconnect(); } } return true; }); }
@Override public boolean await() { PingCommand pingCommand; if (command != null) { pingCommand = new ExecPingCommand(); } else { pingCommand = new DockerHealthPingCommand(); } return Ping.ping(pollIterations, getSleepTime(), getTimeUnit(), pingCommand); }
@Override public boolean await() { return Ping.ping(pollIterations, getSleepTime(), getTimeUnit(), new PingCommand() { @Override public boolean call() {
@Override public boolean await() { PingCommand pingCommand; if (command != null) { pingCommand = new ExecPingCommand(); } else { pingCommand = new DockerHealthPingCommand(); } return Ping.ping(pollIterations, getSleepTime(), getTimeUnit(), pingCommand); }
if (!Ping.ping(mapping.getIP(), mapping.getPort(), this.pollIterations, this.getSleepTime(), this.getTimeUnit())) { return false; case "sscommand": { try { if (!Ping.ping(dockerClientExecutor, cube.getId(), resolveCommand("ss", port), this.pollIterations, this.getSleepTime(), this.getTimeUnit())) { return false; String.format("Pinging host %s and port %s with type", mapping.getIP(), mapping.getPort(), this.type)); if (!Ping.ping(mapping.getIP(), mapping.getPort(), this.pollIterations, this.getSleepTime(), this.getTimeUnit())) { return false;
if (!Ping.ping(mapping.getIP(), mapping.getPort(), this.pollIterations, this.getSleepTime(), this.getTimeUnit())) { return false; case "sscommand": { try { if (!Ping.ping(dockerClientExecutor, cube.getId(), resolveCommand("ss", port), this.pollIterations, this.getSleepTime(), this.getTimeUnit())) { return false; String.format("Pinging host %s and port %s with type", mapping.getIP(), mapping.getPort(), this.type)); if (!Ping.ping(mapping.getIP(), mapping.getPort(), this.pollIterations, this.getSleepTime(), this.getTimeUnit())) { return false;