Github user maoling commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/308#discussion_r131591446
  
    --- Diff: 
src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java ---
    @@ -233,25 +233,25 @@ public QuorumCnxManager(QuorumPeer self) {
             listener = new Listener();
             listener.setName("QuorumPeerListener");
         }
    -
    +    
         /**
    -     * Invokes initiateConnection for testing purposes
    -     * 
    +     * establish Connection with sid using its electionAddr.
          * @param sid
    +     * @param sock
    +     * @throws IOException
          */
    -    public void testInitiateConnection(long sid) throws Exception {
    -        LOG.debug("Opening channel to server " + sid);
    -        Socket sock = new Socket();
    +   public void establishConnection(Long sid, Socket sock) throws 
IOException {
    +           LOG.debug("Opening channel to server " + sid);
             setSockOpts(sock);
             sock.connect(self.getVotingView().get(sid).electionAddr, cnxTO);
    -        initiateConnection(sock, sid);
    -    }
    +        LOG.debug("Connected to server " + sid);
    +   }
         
         /**
          * If this server has initiated the connection, then it gives up on the
          * connection if it loses challenge. Otherwise, it keeps the 
connection.
          */
    -    public boolean initiateConnection(Socket sock, Long sid) {
    +    public boolean initiateConnection(Long sid, Socket sock) {
    --- End diff --
    
    I think put the mutable variables after fixed variables may be better in 
the parameter list;
    such as :
    `private void myMethod(int a, Integer b, String s1, StringBuilder s2){}`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to