NIFI-10895 Handle minifi restarts more gracefully

Signed-off-by: Csaba Bejan <bejan.csaba@gmail.com>

This closes #6852.
This commit is contained in:
Ferenc Erdei 2023-01-16 20:06:08 +01:00 committed by Csaba Bejan
parent b7071cbb04
commit 2abb8921e7
No known key found for this signature in database
GPG Key ID: C59951609F8BDDEB
1 changed files with 6 additions and 2 deletions

View File

@ -305,11 +305,15 @@ public class C2NifiClientService {
}
public void stop() {
try {
bootstrapAcknowledgeExecutorService.shutdownNow();
heartbeatExecutorService.shutdown();
heartbeatExecutorService.awaitTermination(TERMINATION_WAIT, TimeUnit.MILLISECONDS);
try {
if (!heartbeatExecutorService.awaitTermination(TERMINATION_WAIT, TimeUnit.MILLISECONDS)) {
heartbeatExecutorService.shutdownNow();
}
} catch (InterruptedException ignore) {
LOGGER.info("Stopping C2 Client's thread was interrupted but shutting down anyway the C2NifiClientService");
heartbeatExecutorService.shutdownNow();
}
}