boolean pushedOkay = false;
try {
pushFile.call();
pushedOkay = true;
} catch (Exception e) {
ProcessExecution pushExecution = null;
if (e instanceof ProcessExecutionException) {
pushExecution = ((ProcessExecutionException) e).getExecution();
}
if (pushExecution != null && pushExecution.getExitCode() == 1
&& pushExecution.getStdErr().contains("Connection refused")) {
log.info("Got connection refused on push; will retry");
} else {
throw new OpsException("Error pushing file", e);
}
}
if (pushedOkay) {
try {
listenFileFuture.get(5, TimeUnit.SECONDS);
} catch (TimeoutException e) {
log.info("Timeout while waiting for receive to complete");
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new OpsException("Interrupted during file receive", e);
} catch (ExecutionException e) {
throw new OpsException("Error during file receive", e);
}
}
}
if (listenFileFuture.isDone()) {
try {
ProcessExecution listenExecution = listenFileFuture.get();
log.warn("File receiving exited: " + listenExecution);
break;
} catch (ExecutionException e) {
throw new OpsException("Error receiving file", e);
} catch (InterruptedException e) {