Skip to content

Commit

Permalink
Merge branch 'master' into pubsub-hp
Browse files Browse the repository at this point in the history
  • Loading branch information
pongad committed Dec 12, 2016
2 parents a409eac + 15c9e23 commit 43937d7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ private BlockingProcessStreamReader(String emulator, InputStream stream, String
}
}

void terminate() throws IOException {
interrupt();
}

@Override
public void run() {
String previousLine = "";
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,6 @@ Multimap<Level, String> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

0 comments on commit 43937d7

Please sign in to comment.