hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r417261 - /lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Server.java
Date Mon, 26 Jun 2006 18:11:51 GMT
Author: cutting
Date: Mon Jun 26 11:11:51 2006
New Revision: 417261

URL: http://svn.apache.org/viewvc?rev=417261&view=rev
Log:
Fix a bug where server shutdown threw a NullPointerException.

Modified:
    lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Server.java

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Server.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Server.java?rev=417261&r1=417260&r2=417261&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Server.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/ipc/Server.java Mon Jun 26 11:11:51 2006
@@ -233,15 +233,15 @@
       LOG.info("Stopping " + this.getName());
 
       try {
-        if (acceptChannel != null)
-          acceptChannel.close();
-        if (selector != null)
-          selector.close();
+        acceptChannel.close();
+        selector.close();
       } catch (IOException e) { }
 
-      selector= null;
-      acceptChannel= null;
-      connectionList = null;
+      synchronized (this) {
+        selector= null;
+        acceptChannel= null;
+        connectionList = null;
+      }
     }
 
     private void closeCurrentConnection(SelectionKey key, Throwable e) {
@@ -311,10 +311,11 @@
       }
     }   
 
-    void doStop()
-    {
+    synchronized void doStop() {
+      if (selector != null) {
         selector.wakeup();
         Thread.yield();
+      }
     }
   }
 



Mime
View raw message