deniskuzZ commented on PR #3303:
URL: https://github.com/apache/hive/pull/3303#issuecomment-1167566882
I think we should do something like this:
````
ExecutorService executorService =
CompactorUtil.createExecutorWithThreadFactory(numberOfWorkers,
"CompactionHeartbeat-executor-thread-%d");
Ref<CompletableFuture<Void>> submittedTask = Ref.from(null);
Future<?> scheduledTask = heartbeatExecutor.scheduleAtFixedRate(() -> {
submittedTask.value = CompletableFuture.runAsync(heartbeater,
executorService);
}, initialDelay, period, TimeUnit.MILLISECONDS);
tasks.put(txnId, new TaskWrapper(scheduledTask, submittedTask.value));
}
void stopHeartbeat(long txnId) throws InterruptedException {
....
wrapper.scheduledTask.cancel(false);
try {
wrapper.submittedTask.get(initialDelay, 100);
} finally {
tasks.remove(txnId);
}
....
}
````
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]