This is an automated email from the ASF dual-hosted git repository.
bejancsaba pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new 2abb8921e7 NIFI-10895 Handle minifi restarts more gracefully
2abb8921e7 is described below
commit 2abb8921e7a990715f38d1615b930055747467ef
Author: Ferenc Erdei <[email protected]>
AuthorDate: Mon Jan 16 20:06:08 2023 +0100
NIFI-10895 Handle minifi restarts more gracefully
Signed-off-by: Csaba Bejan <[email protected]>
This closes #6852.
---
.../main/java/org/apache/nifi/minifi/c2/C2NifiClientService.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git
a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/C2NifiClientService.java
b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/C2NifiClientService.java
index d56e0d7ce3..ad8f5e5e26 100644
---
a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/C2NifiClientService.java
+++
b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/C2NifiClientService.java
@@ -305,11 +305,15 @@ public class C2NifiClientService {
}
public void stop() {
+ bootstrapAcknowledgeExecutorService.shutdownNow();
+ heartbeatExecutorService.shutdown();
try {
- heartbeatExecutorService.shutdown();
- heartbeatExecutorService.awaitTermination(TERMINATION_WAIT,
TimeUnit.MILLISECONDS);
+ 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();
}
}