Explorar o código

ZOOKEEPER-611. hudson build failure (take 2) (mahadev)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/zookeeper/trunk@888216 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar %!s(int64=15) %!d(string=hai) anos
pai
achega
9ecca8210e
Modificáronse 2 ficheiros con 19 adicións e 14 borrados
  1. 2 0
      CHANGES.txt
  2. 17 14
      src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

+ 2 - 0
CHANGES.txt

@@ -153,6 +153,8 @@ BUGFIXES:
 
   ZOOKEEPER-611.  hudson build failiure (mahadev)
 
+  ZOOKEEPER-611. hudson build failure (take 2) (mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to
   "socket reuse" and failure to close client (phunt via mahadev)

+ 17 - 14
src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java

@@ -71,22 +71,25 @@ public class NIOServerCnxn implements Watcher, ServerCnxn {
 
     private ConnectionBean jmxConnectionBean;
 
-    static {
-        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
-            public void uncaughtException(Thread t, Throwable e) {
-                LOG.error("Thread " + t + " died", e);
+    static public class Factory extends Thread {
+        static {
+            Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+                public void uncaughtException(Thread t, Throwable e) {
+                    LOG.error("Thread " + t + " died", e);
+                }
+            });
+            /**
+             * this is to avoid the jvm bug:
+             * NullPointerException in Selector.open()
+             * http://bugs.sun.com/view_bug.do?bug_id=6427854
+             */
+            try {
+                Selector.open().close();
+            } catch(IOException ie) {
+                LOG.error("Selector failed to open", ie);
             }
-        });
-        /**
-         * this is to avoid the jvm bug:
-         * NullPointerException in Selector.open()
-         * http://bugs.sun.com/view_bug.do?bug_id=6427854
-         */
-        System.setProperty("sun.nio.ch.bugLevel", 
-                System.getProperty("sun.nio.ch.bugLevel",""));
-    }
+        }
 
-    static public class Factory extends Thread {
         ZooKeeperServer zks;
 
         ServerSocketChannel ss;