pgyori commented on a change in pull request #4748:
URL: https://github.com/apache/nifi/pull/4748#discussion_r566105108



##########
File path: nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
##########
@@ -711,6 +716,25 @@ public void dump(final File dumpFile) throws IOException {
         makeRequest(DUMP_CMD, null, dumpFile, "thread dump");
     }
 
+    private boolean isNiFiFullyLoaded() throws IOException {
+        final Logger logger = defaultLogger;
+        final Integer port = getCurrentPort(logger);
+        if (port == null) {
+            logger.info("Apache NiFi is not currently running");

Review comment:
       I modified the code so that when the isNiFiFullyLoaded() method runs 
into this if branch, the nifi.sh script will detect that NiFi hasn't been 
started so there is no point in waiting. This logic is built on the premise 
that (port == null) means that NiFi hasn't been started. However, I found that 
when calling 'bin/nifi.sh start --wait-for-init', the first time 
isNiFiFullyLoaded() is executed happens before NiFi manages to reserve itself a 
port. So in my current solution (next commit) in the nifi.sh script we only 
assume that NiFi hasn't even been started if isNiFiFullyLoaded() runs into 
(port == null) 3 times (2 seconds pass between each call). Of course, it can 
result in exiting the nifi.sh script if it takes more than 4 seconds for NiFi 
to reserve a port.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to