zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hanm <...@git.apache.org>
Subject [GitHub] zookeeper pull request #545: ZOOKEEPER-2261 When only secureClientPort is co...
Date Mon, 30 Jul 2018 04:29:06 GMT
Github user hanm commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/545#discussion_r206012592
  
    --- Diff: src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java ---
    @@ -866,6 +866,9 @@ public void setServerCnxnFactory(ServerCnxnFactory factory) {
         }
     
         public ServerCnxnFactory getServerCnxnFactory() {
    +        if (secureServerCnxnFactory != null) {
    +            return secureServerCnxnFactory;
    +        }
             return serverCnxnFactory;
         }
     
    --- End diff --
    
    I think alternatively we can kill the `setSecureServerCnxnFactory` and have something
like `
         public void setServerCnxnFactory(ServerCnxnFactory factory) {
             if (secure) {
                 secureServerCnxnFactory = factory;
             } else {
                 serverCnxnFactory = factory;
             }
        }`
    
    The basic idea is to make code base consistent and easier to read. Having mixed methods
just cost more brain power to reason about (albeit not a big one in this case).


---

Mime
View raw message