hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jl...@apache.org
Subject svn commit: r1556284 - in /hadoop/common/branches/branch-2/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-yar...
Date Tue, 07 Jan 2014 17:23:50 GMT
Author: jlowe
Date: Tue Jan  7 17:23:50 2014
New Revision: 1556284

URL: http://svn.apache.org/r1556284
Log:
svn merge -c 1556282 FIXES: YARN-1409. NonAggregatingLogHandler can throw RejectedExecutionException.
Contributed by Tsuyoshi OZAWA

Modified:
    hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt
    hadoop/common/branches/branch-2/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-2/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-2/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt?rev=1556284&r1=1556283&r2=1556284&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-yarn-project/CHANGES.txt Tue Jan  7 17:23:50 2014
@@ -277,6 +277,9 @@ Release 2.4.0 - UNRELEASED
     YARN-1560. Fixed TestYarnClient#testAMMRTokens failure with null AMRM token.
     (Ted Yu via jianhe)
 
+    YARN-1409. NonAggregatingLogHandler can throw RejectedExecutionException
+    (Tsuyoshi OZAWA via jlowe)
+
 Release 2.3.0 - UNRELEASED
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/branches/branch-2/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-2/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=1556284&r1=1556283&r2=1556284&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/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-2/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
Tue Jan  7 17:23:50 2014
@@ -23,6 +23,7 @@ import java.util.concurrent.ConcurrentHa
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.RejectedExecutionException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -118,10 +119,17 @@ public class NonAggregatingLogHandler ex
         LOG.info("Scheduling Log Deletion for application: "
             + appFinishedEvent.getApplicationId() + ", with delay of "
             + this.deleteDelaySeconds + " seconds");
-        sched.schedule(
+        LogDeleterRunnable logDeleter =
             new LogDeleterRunnable(appOwners.remove(appFinishedEvent
-                .getApplicationId()), appFinishedEvent.getApplicationId()),
-            this.deleteDelaySeconds, TimeUnit.SECONDS);
+                  .getApplicationId()), appFinishedEvent.getApplicationId());
+        try {
+          sched.schedule(logDeleter, this.deleteDelaySeconds,
+              TimeUnit.SECONDS);
+        } catch (RejectedExecutionException e) {
+          // Handling this event in local thread before starting threads
+          // or after calling sched.shutdownNow().
+          logDeleter.run();
+        }
         break;
       default:
         ; // Ignore

Modified: hadoop/common/branches/branch-2/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-2/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=1556284&r1=1556283&r2=1556284&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/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-2/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
Tue Jan  7 17:23:50 2014
@@ -35,6 +35,7 @@ import org.apache.hadoop.yarn.conf.YarnC
 import org.apache.hadoop.yarn.event.Dispatcher;
 import org.apache.hadoop.yarn.event.DrainDispatcher;
 import org.apache.hadoop.yarn.event.EventHandler;
+import org.apache.hadoop.yarn.event.InlineDispatcher;
 import org.apache.hadoop.yarn.logaggregation.ContainerLogsRetentionPolicy;
 import org.apache.hadoop.yarn.server.nodemanager.DeletionService;
 import org.apache.hadoop.yarn.server.nodemanager.LocalDirsHandlerService;
@@ -202,6 +203,32 @@ public class TestNonAggregatingLogHandle
     verify(logHandler.mockSched).shutdownNow();
   }
 
+  @Test
+  public void testHandlingApplicationFinishedEvent() {
+    Configuration conf = new Configuration();
+    LocalDirsHandlerService dirsService  = new LocalDirsHandlerService();
+    DeletionService delService = new DeletionService(null);
+    NonAggregatingLogHandler aggregatingLogHandler =
+        new NonAggregatingLogHandler(new InlineDispatcher(),
+            delService,
+            dirsService);
+
+    dirsService.init(conf);
+    dirsService.start();
+    delService.init(conf);
+    delService.start();
+    aggregatingLogHandler.init(conf);
+    aggregatingLogHandler.start();
+    ApplicationId appId = BuilderUtils.newApplicationId(1234, 1);
+    // It should NOT throw RejectedExecutionException
+    aggregatingLogHandler.handle(new LogHandlerAppFinishedEvent(appId));
+    aggregatingLogHandler.stop();
+
+    // It should NOT throw RejectedExecutionException after stopping
+    // handler service.
+    aggregatingLogHandler.handle(new LogHandlerAppFinishedEvent(appId));
+  }
+
   private class NonAggregatingLogHandlerWithMockExecutor extends
       NonAggregatingLogHandler {
 



Mime
View raw message