瀏覽代碼

ZOOKEEPER-289. add debug messages to nioserver select loop. (mahadev)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/zookeeper/trunk@740486 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 16 年之前
父節點
當前提交
730a34e14a
共有 2 個文件被更改,包括 13 次插入3 次删除
  1. 2 0
      CHANGES.txt
  2. 11 3
      src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

+ 2 - 0
CHANGES.txt

@@ -150,6 +150,8 @@ flavio via mahadev)
 
    ZOOKEEPER-220. programming guide watches section should clarify
    server/clientlib role in data/child watch maint. (breed via phunt)
+ 
+   ZOOKEEPER-289. add debug messages to nioserver select loop. (mahadev)
 
 NEW FEATURES:
 

+ 11 - 3
src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

@@ -160,6 +160,11 @@ public class NIOServerCnxn implements Watcher, ServerCnxn {
                         } else if ((k.readyOps() & (SelectionKey.OP_READ | SelectionKey.OP_WRITE)) != 0) {
                             NIOServerCnxn c = (NIOServerCnxn) k.attachment();
                             c.doIO(k);
+                        } else {
+                            if (LOG.isDebugEnabled()) {
+                                LOG.debug("Unexpected ops in select "
+                                          + k.readyOps());
+                            }
                         }
                     }
                     selected.clear();
@@ -279,6 +284,9 @@ public class NIOServerCnxn implements Watcher, ServerCnxn {
     void doIO(SelectionKey k) throws InterruptedException {
         try {
             if (sock == null) {
+                LOG.warn("trying to do i/o on a null socket for session:0x"
+                         + Long.toHexString(sessionId));
+
                 return;
             }
             if (k.isReadable()) {
@@ -434,7 +442,7 @@ public class NIOServerCnxn implements Watcher, ServerCnxn {
                             != KeeperException.Code.OK)) {
                 if (ap == null) {
                     LOG.warn("No authentication provider for scheme: "
-                            + scheme + " has " 
+                            + scheme + " has "
                             + ProviderRegistry.listProviders());
                 } else {
                     LOG.warn("Authentication failed for scheme: " + scheme);
@@ -502,7 +510,7 @@ public class NIOServerCnxn implements Watcher, ServerCnxn {
                 + Long.toHexString(connReq.getLastZxidSeen())
                 + " our last zxid is 0x"
                 + Long.toHexString(zk.dataTree.lastProcessedZxid);
-            
+
             LOG.error(msg);
             throw new IOException(msg);
         }
@@ -885,7 +893,7 @@ public class NIOServerCnxn implements Watcher, ServerCnxn {
             close();
         }
     }
-    
+
     /*
      * (non-Javadoc)
      *