hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject svn commit: r1390694 - in /hadoop/common/branches/branch-0.23/hadoop-yarn-project: ./ hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/loghandler/ hadoop-yarn/hadoop-...
Date Wed, 26 Sep 2012 19:35:12 GMT
Author: bobby
Date: Wed Sep 26 19:35:12 2012
New Revision: 1390694

URL: http://svn.apache.org/viewvc?rev=1390694&view=rev
Log:
svn merge -c 1380954 FIXES: YARN-42. Modify NM's non-aggregating logs' handler to stop properly
so that NMs don't get NPEs on startup errors. Contributed by Devaraj K.

Modified:
    hadoop/common/branches/branch-0.23/hadoop-yarn-project/CHANGES.txt
    hadoop/common/branches/branch-0.23/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/loghandler/NonAggregatingLogHandler.java
    hadoop/common/branches/branch-0.23/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/loghandler/TestNonAggregatingLogHandler.java

Modified: hadoop/common/branches/branch-0.23/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-yarn-project/CHANGES.txt?rev=1390694&r1=1390693&r2=1390694&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.23/hadoop-yarn-project/CHANGES.txt Wed Sep 26 19:35:12
2012
@@ -18,6 +18,9 @@ Release 0.23.4 - UNRELEASED
     YARN-88. DefaultContainerExecutor can fail to set proper permissions.
     (Jason Lowe via sseth)
 
+    YARN-42. Modify NM's non-aggregating logs' handler to stop properly so that
+    NMs don't get NPEs on startup errors. (Devaraj K via vinodkv)
+
 Release 0.23.3 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-0.23/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/loghandler/NonAggregatingLogHandler.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/loghandler/NonAggregatingLogHandler.java?rev=1390694&r1=1390693&r2=1390694&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/loghandler/NonAggregatingLogHandler.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/loghandler/NonAggregatingLogHandler.java
Wed Sep 26 19:35:12 2012
@@ -79,16 +79,18 @@ public class NonAggregatingLogHandler ex
 
   @Override
   public void stop() {
-    sched.shutdown();
-    boolean isShutdown = false;
-    try {
-      isShutdown = sched.awaitTermination(10, TimeUnit.SECONDS);
-    } catch (InterruptedException e) {
-      sched.shutdownNow();
-      isShutdown = true;
-    }
-    if (!isShutdown) {
-      sched.shutdownNow();
+    if (sched != null) {
+      sched.shutdown();
+      boolean isShutdown = false;
+      try {
+        isShutdown = sched.awaitTermination(10, TimeUnit.SECONDS);
+      } catch (InterruptedException e) {
+        sched.shutdownNow();
+        isShutdown = true;
+      }
+      if (!isShutdown) {
+        sched.shutdownNow();
+      }
     }
     super.stop();
   }

Modified: hadoop/common/branches/branch-0.23/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/loghandler/TestNonAggregatingLogHandler.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/loghandler/TestNonAggregatingLogHandler.java?rev=1390694&r1=1390693&r2=1390694&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/loghandler/TestNonAggregatingLogHandler.java
(original)
+++ hadoop/common/branches/branch-0.23/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/loghandler/TestNonAggregatingLogHandler.java
Wed Sep 26 19:35:12 2012
@@ -183,6 +183,24 @@ public class TestNonAggregatingLogHandle
     verify(mockSched).schedule(any(Runnable.class), eq(10800l),
         eq(TimeUnit.SECONDS));
   }
+  
+  @Test
+  public void testStop() throws Exception {
+    NonAggregatingLogHandler aggregatingLogHandler = 
+        new NonAggregatingLogHandler(null, null, null);
+
+    // It should not throw NullPointerException
+    aggregatingLogHandler.stop();
+
+    NonAggregatingLogHandlerWithMockExecutor logHandler = 
+        new NonAggregatingLogHandlerWithMockExecutor(null, null, null);
+    logHandler.init(new Configuration());
+    logHandler.stop();
+    verify(logHandler.mockSched).shutdown();
+    verify(logHandler.mockSched)
+        .awaitTermination(eq(10l), eq(TimeUnit.SECONDS));
+    verify(logHandler.mockSched).shutdownNow();
+  }
 
   private class NonAggregatingLogHandlerWithMockExecutor extends
       NonAggregatingLogHandler {



Mime
View raw message