Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-2140

NettyServerCnxn and NIOServerCnxn code should be improved

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.5.1, 3.6.0
    • None
    • None

    Description

      Classes org.apache.zookeeper.server.NIOServerCnxn and org.apache.zookeeper.server.NettyServerCnxn have following need and scope for improvement
      1) Duplicate code.
      These two classes have around 250 line duplicate code. All the command code is duplicated
      2) Many improvement/bugFix done in one class but not done in other class. These changes should be synced
      For example

      In NettyServerCnxn

                     // clone should be faster than iteration
                      // ie give up the cnxns lock faster
                      AbstractSet<ServerCnxn> cnxns;
                      synchronized (factory.cnxns) {
                          cnxns = new HashSet<ServerCnxn>(factory.cnxns);
                      }
                      for (ServerCnxn c : cnxns) {
                          c.dumpConnectionInfo(pw, false);
                          pw.println();
                      }
      

      In NIOServerCnxn

                     for (ServerCnxn c : factory.cnxns) {
                          c.dumpConnectionInfo(pw, false);
                          pw.println();
                      }
      

      3) NettyServerCnxn and NIOServerCnxn classes are bulky unnecessarily. Command classes have altogether different functionality, the command classes should go in different class files.
      If this done it will be easy to add new command with minimal change to existing classes.

      Attachments

        1. ZOOKEEPER-2140-1.patch
          69 kB
          Mohammad Arshad
        2. ZOOKEEPER-2140-2.patch
          69 kB
          Mohammad Arshad
        3. ZOOKEEPER-2140-3.patch
          81 kB
          Mohammad Arshad
        4. ZOOKEEPER-2140-4.patch
          79 kB
          Mohammad Arshad

        Issue Links

          Activity

            People

              arshad.mohammad Mohammad Arshad
              arshad.mohammad Mohammad Arshad
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: