diff --git a/google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java b/google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java index dee22e596c11..2b4276068d7b 100644 --- a/google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java +++ b/google-cloud-core/src/main/java/com/google/cloud/testing/BaseEmulatorHelper.java @@ -114,15 +114,15 @@ protected final void startProcess(String blockUntilOutput) * and stop any possible thread listening for its output. */ protected final int waitForProcess(Duration timeout) throws IOException, InterruptedException, TimeoutException { - if (blockingProcessReader != null) { - blockingProcessReader.terminate(); - blockingProcessReader = null; - } if (activeRunner != null) { int exitCode = activeRunner.waitFor(timeout); activeRunner = null; return exitCode; } + if (blockingProcessReader != null) { + blockingProcessReader.join(); + blockingProcessReader = null; + } return 0; } diff --git a/google-cloud-core/src/main/java/com/google/cloud/testing/BlockingProcessStreamReader.java b/google-cloud-core/src/main/java/com/google/cloud/testing/BlockingProcessStreamReader.java index 0fa10dcacebb..f4e69b9b6e19 100644 --- a/google-cloud-core/src/main/java/com/google/cloud/testing/BlockingProcessStreamReader.java +++ b/google-cloud-core/src/main/java/com/google/cloud/testing/BlockingProcessStreamReader.java @@ -61,10 +61,6 @@ private BlockingProcessStreamReader(String emulator, InputStream stream, String } } - void terminate() throws IOException { - interrupt(); - } - @Override public void run() { String previousLine = ""; @@ -79,9 +75,7 @@ public void run() { processLogLine(previousLine, nextLine); } } catch (IOException e) { - if (!isInterrupted()) { - e.printStackTrace(System.err); - } + e.printStackTrace(System.err); } processLogLine(previousLine, firstNonNull(nextLine, "")); writeLog(); diff --git a/google-cloud-core/src/test/java/com/google/cloud/testing/BlockingProcessStreamReaderTest.java b/google-cloud-core/src/test/java/com/google/cloud/testing/BlockingProcessStreamReaderTest.java index 6dedcb55b680..1b22c9f3ff91 100644 --- a/google-cloud-core/src/test/java/com/google/cloud/testing/BlockingProcessStreamReaderTest.java +++ b/google-cloud-core/src/test/java/com/google/cloud/testing/BlockingProcessStreamReaderTest.java @@ -74,15 +74,6 @@ Multimap getLogs() { } } - @Test - public void testBlockUntil() throws IOException { - InputStream stream = new ByteArrayInputStream(OUTPUT.getBytes(Charsets.UTF_8)); - BlockingProcessStreamReader thread = - BlockingProcessStreamReader.start("emulator", stream, BLOCK_UNTIL, null); - thread.terminate(); - stream.close(); - } - @Test public void testForwardLogEntry() throws IOException, InterruptedException { TestLogger logger = new TestLogger(); diff --git a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/LocalSystemTest.java b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/LocalSystemTest.java index 3edb6342c0cb..aba64436933b 100644 --- a/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/LocalSystemTest.java +++ b/google-cloud-pubsub/src/test/java/com/google/cloud/pubsub/LocalSystemTest.java @@ -50,6 +50,6 @@ public static void startServer() throws IOException, InterruptedException { public static void stopServer() throws Exception { pubsub.close(); pubsubHelper.reset(); - pubsubHelper.stop(Duration.standardMinutes(1)); + pubsubHelper.stop(Duration.standardMinutes(3)); } }