This is an automated email from the ASF dual-hosted git repository.
exceptionfactory 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 04348cbf172 NIFI-16603 Fixed Bootstrap stop command status after
forced termination (#11941)
04348cbf172 is described below
commit 04348cbf1721f14e09fc511abadce581395cd3a4
Author: Anshu Singh <[email protected]>
AuthorDate: Wed Nov 18 22:35:26 2026 +0530
NIFI-16603 Fixed Bootstrap stop command status after forced termination
(#11941)
Signed-off-by: David Handermann <[email protected]>
---
.../nifi/bootstrap/command/StopBootstrapCommand.java | 4 ++--
.../nifi/bootstrap/command/StopBootstrapCommandTest.java | 15 +++++++++++++++
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git
a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/command/StopBootstrapCommand.java
b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/command/StopBootstrapCommand.java
index 3e4f47f6c91..3575a54a7ed 100644
---
a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/command/StopBootstrapCommand.java
+++
b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/command/StopBootstrapCommand.java
@@ -107,9 +107,9 @@ class StopBootstrapCommand implements BootstrapCommand {
private void destroyForcibly(final ProcessHandle applicationProcessHandle)
{
final boolean destroyForciblyRequested =
applicationProcessHandle.destroyForcibly();
if (destroyForciblyRequested) {
- logger.warn("Application Process [{}] force termination failed",
applicationProcessHandle.pid());
- } else {
onDestroyForciblyCompleted(applicationProcessHandle);
+ } else {
+ logger.warn("Application Process [{}] force termination failed",
applicationProcessHandle.pid());
}
}
diff --git
a/nifi-bootstrap/src/test/java/org/apache/nifi/bootstrap/command/StopBootstrapCommandTest.java
b/nifi-bootstrap/src/test/java/org/apache/nifi/bootstrap/command/StopBootstrapCommandTest.java
index 37f293d933c..caa21571d19 100644
---
a/nifi-bootstrap/src/test/java/org/apache/nifi/bootstrap/command/StopBootstrapCommandTest.java
+++
b/nifi-bootstrap/src/test/java/org/apache/nifi/bootstrap/command/StopBootstrapCommandTest.java
@@ -84,4 +84,19 @@ class StopBootstrapCommandTest {
assertEquals(CommandStatus.ERROR, commandStatus);
}
+
+ @Test
+ void testRunDestroyForciblyCompleted() {
+
when(processHandleProvider.findApplicationProcessHandle()).thenReturn(Optional.of(applicationProcessHandle));
+ when(applicationProcessHandle.destroy()).thenReturn(true);
+ when(applicationProcessHandle.destroyForcibly()).thenReturn(true);
+ when(applicationProcessHandle.onExit())
+ .thenReturn(CompletableFuture.failedFuture(new
RuntimeException()))
+
.thenReturn(CompletableFuture.completedFuture(applicationProcessHandle));
+
+ command.run();
+ final CommandStatus commandStatus = command.getCommandStatus();
+
+ assertEquals(CommandStatus.SUCCESS, commandStatus);
+ }
}