NIFI-14156 Improve Bootstrap Process on Windows with Attach API #9683
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
NIFI-14156 Improves the application bootstrap process when running on Microsoft Windows using the Java Attach API to find the application process for status and shutdown. These changes resolve issues with the
nifi.cmd stop
andnifi.cmd status
commands not working.The restructured bootstrap process for NiFi 2 uses the ProcessHandle interface added in Java 9. The OpenJDK implementation for Linux and macOS provides command arguments for the associated process, but the implementation in Windows does not provide command arguments as of Java 21. JDK-8176725 describes the lack of support on Windows.
To maintain the stateless behavior of the application bootstrap process on Windows, changes in this pull request introduce new process handle discovery classes based on the Attach API and the VirtualMachine class. The
VirtualMachine.getSystemProperties()
method returns the system properties containing the information required to identify the bootstrap and application processes. This approach is implemented using feature detection whenProcessHandle.Info.arguments()
is empty, preserving existing behavior on Linux and macOS.Additional changes include correcting the
nifi.cmd
to avoid passing the application properties argument to the bootstrap process, and adjusting thestart
command behavior to launch the application in a new minimized window. The adjusted start behavior then returns to the command prompt, enabling subsequent commands such asstatus
orstop
as needed.Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000
NIFI-00000
Pull Request Formatting
main
branchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-check
Licensing
LICENSE
andNOTICE
filesDocumentation