hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmcc...@apache.org
Subject git commit: HADOOP-10404. Commit correct version of patch (cmccabe)
Date Mon, 06 Oct 2014 21:44:50 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 8099de259 -> 687d83c9e


HADOOP-10404.  Commit correct version of patch (cmccabe)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/687d83c9
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/687d83c9
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/687d83c9

Branch: refs/heads/trunk
Commit: 687d83c9e10a4432c8d54c2cd406c7ccb4392187
Parents: 8099de2
Author: Colin Patrick Mccabe <cmccabe@cloudera.com>
Authored: Mon Oct 6 14:44:13 2014 -0700
Committer: Colin Patrick Mccabe <cmccabe@cloudera.com>
Committed: Mon Oct 6 14:44:13 2014 -0700

----------------------------------------------------------------------
 .../hadoop/net/unix/DomainSocketWatcher.java    | 23 ++++++++++----------
 1 file changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/687d83c9/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/unix/DomainSocketWatcher.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/unix/DomainSocketWatcher.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/unix/DomainSocketWatcher.java
index 6215e58..95ef30d 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/unix/DomainSocketWatcher.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/unix/DomainSocketWatcher.java
@@ -101,7 +101,7 @@ public final class DomainSocketWatcher implements Closeable {
    */
   private class NotificationHandler implements Handler {
     public boolean handle(DomainSocket sock) {
-      lock.lock();
+      assert(lock.isHeldByCurrentThread());
       try {
         if (LOG.isTraceEnabled()) {
           LOG.trace(this + ": NotificationHandler: doing a read on " +
@@ -125,8 +125,6 @@ public final class DomainSocketWatcher implements Closeable {
         }
         closed = true;
         return true;
-      } finally {
-        lock.unlock();
       }
     }
   }
@@ -349,15 +347,13 @@ public final class DomainSocketWatcher implements Closeable {
    * Wake up the DomainSocketWatcher thread.
    */
   private void kick() {
-    lock.lock();
+    assert(lock.isHeldByCurrentThread());
     try {
       notificationSockets[0].getOutputStream().write(0);
     } catch (IOException e) {
       if (!closed) {
         LOG.error(this + ": error writing to notificationSockets[0]", e);
       }
-    } finally {
-      lock.unlock();
     }
   }
 
@@ -467,12 +463,17 @@ public final class DomainSocketWatcher implements Closeable {
       } catch (IOException e) {
         LOG.error(toString() + " terminating on IOException", e);
       } finally {
-        kick(); // allow the handler for notificationSockets[0] to read a byte
-        for (Entry entry : entries.values()) {
-          sendCallback("close", entries, fdSet, entry.getDomainSocket().fd);
+        lock.lock();
+        try {
+          kick(); // allow the handler for notificationSockets[0] to read a byte
+          for (Entry entry : entries.values()) {
+            sendCallback("close", entries, fdSet, entry.getDomainSocket().fd);
+          }
+          entries.clear();
+          fdSet.close();
+        } finally {
+          lock.unlock();
         }
-        entries.clear();
-        fdSet.close();
       }
     }
   });


Mime
View raw message