Skip to content

Commit

Permalink
Remove needless thread
Browse files Browse the repository at this point in the history
  • Loading branch information
komamitsu committed Mar 4, 2019
1 parent 22ca0f7 commit 1aadf90
Showing 1 changed file with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,29 +125,13 @@ private void closeBufferQuietly()
{
LOG.trace("Closing the buffer");

ExecutorService executorServiceForBufferClose = Executors.newSingleThreadExecutor();
try {
// TODO: Should remove this nonblocking operation?
Future<Void> future = executorServiceForBufferClose.submit(() -> {
buffer.close();
isTerminated.set(true);
return null;
});

future.get(config.getWaitUntilTerminated(), TimeUnit.SECONDS);
}
catch (InterruptedException e) {
LOG.warn("Failed to close the buffer", e);
Thread.currentThread().interrupt();
buffer.close();
}
catch (Throwable e) {
LOG.warn("Failed to close the buffer", e);
}
finally {
ExecutorServiceUtils.finishExecutorService(
executorServiceForBufferClose,
config.getWaitUntilBufferFlushed());
}
isTerminated.set(true);
}

private void closeIngesterQuietly()
Expand Down

0 comments on commit 1aadf90

Please sign in to comment.