@Test public void throwsExitException() throws Throwable { ProcessBuilder builder = new ProcessBuilder("python3", "-c", "import sys; sys.exit(76)"); StreamingProcess process = new StreamingProcess("StallTest", builder, 3); try { CompletableFuture<Void> processFuture = process.start(); processFuture.get(5, TimeUnit.SECONDS); fail("Expected ExecutionException"); } catch (ExecutionException e) { assertTrue(e.getCause() instanceof StreamingProcessExitException); StreamingProcessExitException exitException = (StreamingProcessExitException) e.getCause(); assertEquals(StreamingProcessExitReason.STREAM_STALLED, exitException.getExitReason()); } }
public CompletableFuture<Void> start() { Process process = createProcess(); return CompletableFuture.runAsync(() -> restartUntilDone(process), THREAD_POOL); }
StreamingProcess { public CompletableFuture<Void> start() { Process process = createProcess(); return CompletableFuture.runAsync(() -> restartUntilDone(process), THREAD_POOL); } }
StreamingProcess { public CompletableFuture<Void> start() { Process process = createProcess(); return CompletableFuture.runAsync(() -> restartUntilDone(process), THREAD_POOL); } StreamingProcess(String executable, ProcessBuilder processBuilder, int maxNumRestarts); }
StreamingProcess { public CompletableFuture<Void> start() { Process process = createProcess(); return CompletableFuture.runAsync(() -> restartUntilDone(process), THREAD_POOL); } StreamingProcess(String executable, ProcessBuilder processBuilder, int maxNumRestarts); CompletableFuture<Void> start(); void quit(); }
StreamingProcess { public CompletableFuture<Void> start() { Process process = createProcess(); return CompletableFuture.runAsync(() -> restartUntilDone(process), THREAD_POOL); } StreamingProcess(String executable, ProcessBuilder processBuilder, int maxNumRestarts); CompletableFuture<Void> start(); void quit();  }