markap14 commented on a change in pull request #5004:
URL: https://github.com/apache/nifi/pull/5004#discussion_r615836627



##########
File path: nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java
##########
@@ -808,6 +815,63 @@ public void notifyStop() {
                 "Hello,\n\nApache NiFi has been told to initiate a shutdown on 
host " + hostname + " at " + now + " by user " + user);
     }
 
+    public Integer decommission() throws IOException {
+        final Logger logger = cmdLogger;
+        final Integer port = getCurrentPort(logger);
+        if (port == null) {
+            logger.info("Apache NiFi is not currently running");
+            return 15;
+        }
+
+        // indicate that a stop command is in progress
+        final File lockFile = getLockFile(logger);
+        if (!lockFile.exists()) {
+            lockFile.createNewFile();
+        }
+
+        final Properties nifiProps = loadProperties(logger);
+        final String secretKey = nifiProps.getProperty("secret.key");
+        final String pid = nifiProps.getProperty(PID_KEY);
+        final File statusFile = getStatusFile(logger);
+        final File pidFile = getPidFile(logger);
+
+        try (final Socket socket = new Socket()) {
+            logger.debug("Connecting to NiFi instance");
+            socket.setSoTimeout(10000);

Review comment:
       @jfrazee this is intentional - I don't think we want to use a constant. 
The timeout being used is based on the operation being performed. For something 
like a ping/status check, the expectation is that it should be immediate so a 
10 second timeout is reasonable. For a thread dump, it'll take a bit longer. 
For a diagnostic dump, the expectation is that it may take several seconds so 
we probably use a longer timeout.




-- 
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:
us...@infra.apache.org


Reply via email to