Skip to content

Commit

Permalink
Merge pull request #124 from komamitsu/remove-needless-thread
Browse files Browse the repository at this point in the history
Remove needless thread
  • Loading branch information
komamitsu committed Mar 4, 2019
2 parents 22ca0f7 + 1aadf90 commit 13c8c18
Showing 1 changed file with 2 additions and 18 deletions.
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 13c8c18

Please sign in to comment.