jfrazee commented on a change in pull request #4592:
URL: https://github.com/apache/nifi/pull/4592#discussion_r508113540



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/providers/zookeeper/ZooKeeperStateProvider.java
##########
@@ -167,11 +289,26 @@ synchronized ZooKeeper getZooKeeper() throws IOException {
         }
 
         if (zooKeeper == null) {
-            zooKeeper = new ZooKeeper(connectionString, timeoutMillis, new 
Watcher() {
-                @Override
-                public void process(WatchedEvent event) {
+            if(zooKeeperClientConfig != null && 
zooKeeperClientConfig.getClientSecure()) {
+                SecureClientZooKeeperFactory factory = new 
SecureClientZooKeeperFactory(zooKeeperClientConfig);
+                try {
+                    zooKeeper = factory.newZooKeeper(connectionString, 
timeoutMillis, new Watcher() {
+                        @Override
+                        public void process(WatchedEvent event) {
+                        }
+                    }, true);
+                } catch (Exception e) {
+                    System.out.println("Secure Zookeeper configuration 
failed!");
+                    e.printStackTrace();
+                    invalidateClient();
                 }
-            });
+            } else {
+                zooKeeper = new ZooKeeper(connectionString, timeoutMillis, new 
Watcher() {
+                    @Override
+                    public void process(WatchedEvent event) {
+                    }
+                });

Review comment:
       I think this does the right thing if the callback is null.
   ```suggestion
                   zooKeeper = new ZooKeeper(connectionString, timeoutMillis, 
null);
   ```




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