Skip to content

Commit

Permalink
DF/kafka: try to achieve more smooth app shutdown
Browse files Browse the repository at this point in the history
When the application stops, it is very rare that it will shutdown
  all the subprocesses (see Issue #45).
  • Loading branch information
mgolosova committed Oct 9, 2017
1 parent a03865d commit dd0fb5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ public void run() {
while ((line = STDERR.readLine()) != null) {
external_log(line);
}
} catch (IOException e) {
log.error("Failed to read from the process STDERR.");
throw new KafkaException(e);
}
} catch (IOException e) { }
}

private void external_log(String line) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ public void punctuate(long timestamp) {
@Override
public void close() {
log.info("Destroying external process.");
this.externalProcessor.destroy();
try {
this.externalProcessor.destroy();
this.externalProcessor.waitFor(2L, TimeUnit.SECONDS);
} catch (InterruptedException int_e) { }

}

public void start() {
Expand Down

0 comments on commit dd0fb5f

Please sign in to comment.