This is an automated email from the ASF dual-hosted git repository. alopresto pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/master by this push: new 3686ee2 NIFI-6653 Change bootstrap port command handling 3686ee2 is described below commit 3686ee2a164266543daea7395c211a1bdb31afb9 Author: Kevin Doran <kdo...@apache.org> AuthorDate: Wed Sep 11 15:40:40 2019 -0400 NIFI-6653 Change bootstrap port command handling This closes #3722. Signed-off-by: Andy LoPresto <alopre...@apache.org> --- .../src/main/java/org/apache/nifi/bootstrap/RunNiFi.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java index 5b1334c..50a0e32 100644 --- a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java +++ b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java @@ -116,8 +116,10 @@ public class RunNiFi { public static final String DUMP_CMD = "DUMP"; public static final String DIAGNOSTICS_CMD = "DIAGNOSTICS"; + 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 nifiPid = -1L; private volatile String secretKey; private volatile ShutdownHook shutdownHook; @@ -1376,6 +1378,12 @@ public class RunNiFi { } void setNiFiCommandControlPort(final int port, final String secretKey) throws IOException { + + if (this.secretKey != null && this.ccPort != UNINITIALIZED_CC_PORT) { + defaultLogger.warn("Blocking attempt to change NiFi command port and secret after they have already been initialized. requestedPort={}", port); + return; + } + this.ccPort = port; this.secretKey = secretKey;