You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@zookeeper.apache.org by "maoling (Jira)" <ji...@apache.org> on 2019/10/08 07:32:00 UTC

[jira] [Created] (ZOOKEEPER-3570) add the constant for cxid

maoling created ZOOKEEPER-3570:
----------------------------------

             Summary: add the constant for cxid
                 Key: ZOOKEEPER-3570
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3570
             Project: ZooKeeper
          Issue Type: Improvement
          Components: server
    Affects Versions: 3.6.0
            Reporter: maoling


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

we need a constant for cxid
{code:java}
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) {
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)