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

make the special client xid constant

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6.0
    • Fix Version/s: 3.6.0
    • Component/s: server

      Description

      in the ClientCnxn, we had hard-code cxid which is not elegant.

      we need a constant for cxid

      if (replyHdr.getXid() == -2) {
          // -2 is the xid for pings
          if (LOG.isDebugEnabled()) {
              LOG.debug("Got ping response for sessionid: 0x"
                        + Long.toHexString(sessionId)
                        + " after "
                        + ((System.nanoTime() - lastPingSentNs) / 1000000)
                        + "ms");
          }
          return;
      }
      if (replyHdr.getXid() == -4) {
          // -4 is the xid for AuthPacket
          if (replyHdr.getErr() == KeeperException.Code.AUTHFAILED.intValue()) {
              state = States.AUTH_FAILED;
              eventThread.queueEvent(new WatchedEvent(Watcher.Event.EventType.None, Watcher.Event.KeeperState.AuthFailed, null));
              eventThread.queueEventOfDeath();
          }
          if (LOG.isDebugEnabled()) {
              LOG.debug("Got auth sessionid:0x" + Long.toHexString(sessionId));
          }
          return;
      }
      if (replyHdr.getXid() == -1) {
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                maoling maoling
                Reporter:
                maoling maoling
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m