You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by bb...@apache.org on 2019/09/23 18:27:50 UTC

[nifi-minifi] branch master updated: MINIFI-512 Change bootstrap port command handling

This is an automated email from the ASF dual-hosted git repository.

bbende pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi.git


The following commit(s) were added to refs/heads/master by this push:
     new 55aac22  MINIFI-512 Change bootstrap port command handling
55aac22 is described below

commit 55aac229331f520232644959d0b11e95616d3ca1
Author: Kevin Doran <kd...@apache.org>
AuthorDate: Wed Sep 11 15:51:03 2019 -0400

    MINIFI-512 Change bootstrap port command handling
---
 .../main/java/org/apache/nifi/minifi/bootstrap/RunMiNiFi.java  | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/RunMiNiFi.java b/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/RunMiNiFi.java
index cc59f68..2fb4e0b 100644
--- a/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/RunMiNiFi.java
+++ b/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/RunMiNiFi.java
@@ -227,8 +227,10 @@ public class RunMiNiFi implements QueryableStatusAggregator, ConfigurationFileHo
         BOOTSTRAP_KEYS_TO_YML_KEYS = Collections.unmodifiableMap(mutableMap);
     }
 
+    private static final int UNINITIALIZED_CC_PORT = -1;
+
     private volatile boolean autoRestartNiFi = true;
-    private volatile int ccPort = -1;
+    private volatile int ccPort = UNINITIALIZED_CC_PORT;
     private volatile long minifiPid = -1L;
     private volatile String secretKey;
     private volatile ShutdownHook shutdownHook;
@@ -1562,6 +1564,12 @@ public class RunMiNiFi implements QueryableStatusAggregator, ConfigurationFileHo
     }
 
     void setMiNiFiCommandControlPort(final int port, final String secretKey) throws IOException {
+
+        if (this.secretKey != null && this.ccPort != UNINITIALIZED_CC_PORT) {
+            defaultLogger.warn("Blocking attempt to change MiNiFi command port and secret after they have already been initialized. requestedPort={}", port);
+            return;
+        }
+
         this.ccPort = port;
         this.secretKey = secretKey;