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


The following commit(s) were added to refs/heads/master by this push:
     new 71aa4cc  NIFIREG-318 Change bootstrap port command handling
71aa4cc is described below

commit 71aa4cc92a6410d70980567e6963967301708548
Author: Kevin Doran <[email protected]>
AuthorDate: Wed Sep 11 17:07:29 2019 -0400

    NIFIREG-318 Change bootstrap port command handling
---
 .../org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java    | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git 
a/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java
 
b/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java
index c3bc172..e7a46b7 100644
--- 
a/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java
+++ 
b/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java
@@ -99,8 +99,10 @@ public class RunNiFiRegistry {
     public static final String PING_CMD = "PING";
     public static final String DUMP_CMD = "DUMP";
 
+    private static final int UNINITIALIZED_CC_PORT = -1;
+
     private volatile boolean autoRestartNiFiRegistry = true;
-    private volatile int ccPort = -1;
+    private volatile int ccPort = UNINITIALIZED_CC_PORT;
     private volatile long nifiRegistryPid = -1L;
     private volatile String secretKey;
     private volatile ShutdownHook shutdownHook;
@@ -1178,6 +1180,12 @@ public class RunNiFiRegistry {
     }
 
     void setNiFiRegistryCommandControlPort(final int port, final String 
secretKey) throws IOException {
+
+        if (this.secretKey != null && this.ccPort != UNINITIALIZED_CC_PORT) {
+            defaultLogger.warn("Blocking attempt to change NiFi Registry 
command port and secret after they have already been initialized. 
requestedPort={}", port);
+            return;
+        }
+
         this.ccPort = port;
         this.secretKey = secretKey;
 

Reply via email to