You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/01/02 11:18:32 UTC

[GitHub] [zookeeper] maoling commented on a change in pull request #1197: ZOOKEEPER-3669: Use switch Statement in ClientCnxn SendThread

maoling commented on a change in pull request #1197: ZOOKEEPER-3669: Use switch Statement in ClientCnxn SendThread
URL: https://github.com/apache/zookeeper/pull/1197#discussion_r362440719
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
 ##########
 @@ -867,24 +867,24 @@ void readResponse(ByteBuffer incomingBuffer) throws IOException {
             ReplyHeader replyHdr = new ReplyHeader();
 
             replyHdr.deserialize(bbia, "header");
-            if (replyHdr.getXid() == PING_XID) {
-                LOG.debug(
-                    "Got ping response for session id: 0x{} after {}ms.",
+            switch (replyHdr.getXid()) {
+            case PING_XID:
+                LOG.debug("Got ping response for session id: 0x{} after {}ms.",
                     Long.toHexString(sessionId),
                     ((System.nanoTime() - lastPingSentNs) / 1000000));
                 return;
-            }
-            if (replyHdr.getXid() == AUTHPACKET_XID) {
+              case AUTHPACKET_XID:
+                LOG.debug("Got auth session id: 0x{}", Long.toHexString(sessionId));
                 if (replyHdr.getErr() == KeeperException.Code.AUTHFAILED.intValue()) {
 
 Review comment:
   `LOG.debug` is before `return` at last, not just after `case`. It doesn't matter

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services