hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ss...@apache.org
Subject svn commit: r1380786 - in /hadoop/common/branches/MR-3902/hadoop-mapreduce-project: CHANGES.txt.MR-3902 hadoop-mapreduce-client/hadoop-mapreduce-client-app2/src/main/java/org/apache/hadoop/mapreduce/v2/app2/rm/container/AMContainerMap.java
Date Tue, 04 Sep 2012 18:23:28 GMT
Author: sseth
Date: Tue Sep  4 18:23:28 2012
New Revision: 1380786

URL: http://svn.apache.org/viewvc?rev=1380786&view=rev
Log:
MAPREDUCE-4619. Change AMContainerMap to extend AbstractService. (Contributed by Tsuyoshi
OZAWA)

Modified:
    hadoop/common/branches/MR-3902/hadoop-mapreduce-project/CHANGES.txt.MR-3902
    hadoop/common/branches/MR-3902/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app2/src/main/java/org/apache/hadoop/mapreduce/v2/app2/rm/container/AMContainerMap.java

Modified: hadoop/common/branches/MR-3902/hadoop-mapreduce-project/CHANGES.txt.MR-3902
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-3902/hadoop-mapreduce-project/CHANGES.txt.MR-3902?rev=1380786&r1=1380785&r2=1380786&view=diff
==============================================================================
--- hadoop/common/branches/MR-3902/hadoop-mapreduce-project/CHANGES.txt.MR-3902 (original)
+++ hadoop/common/branches/MR-3902/hadoop-mapreduce-project/CHANGES.txt.MR-3902 Tue Sep  4
18:23:28 2012
@@ -10,3 +10,5 @@ Branch MR-3902
   MAPREDUCE-4625. Statistics logging in the AM scheduler. (sseth)
 
   MAPREDUCE-4624. Reduce scheduling fixes, factor in MR-4437. (sseth)
+
+  MAPREDUCE-4619. Change AMContainerMap to extend AbstractService (Tsuyoshi OZAWA via sseth)

Modified: hadoop/common/branches/MR-3902/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app2/src/main/java/org/apache/hadoop/mapreduce/v2/app2/rm/container/AMContainerMap.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-3902/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app2/src/main/java/org/apache/hadoop/mapreduce/v2/app2/rm/container/AMContainerMap.java?rev=1380786&r1=1380785&r2=1380786&view=diff
==============================================================================
--- hadoop/common/branches/MR-3902/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app2/src/main/java/org/apache/hadoop/mapreduce/v2/app2/rm/container/AMContainerMap.java
(original)
+++ hadoop/common/branches/MR-3902/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app2/src/main/java/org/apache/hadoop/mapreduce/v2/app2/rm/container/AMContainerMap.java
Tue Sep  4 18:23:28 2012
@@ -1,5 +1,6 @@
 package org.apache.hadoop.mapreduce.v2.app2.rm.container;
 
+import java.util.Collection;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.hadoop.mapreduce.jobhistory.ContainerHeartbeatHandler;
@@ -8,11 +9,9 @@ import org.apache.hadoop.mapreduce.v2.ap
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.event.EventHandler;
+import org.apache.hadoop.yarn.service.AbstractService;
 
-// TODO Extending concurrentHashMap seems weird. May be simpler to just have some 
-// simple methods. The iterator is kindof useful though.
-@SuppressWarnings("serial")
-public class AMContainerMap extends ConcurrentHashMap<ContainerId, AMContainer>
+public class AMContainerMap extends AbstractService
     implements EventHandler<AMContainerEvent> {
 
   private final ContainerHeartbeatHandler chh;
@@ -20,25 +19,36 @@ public class AMContainerMap extends Conc
   @SuppressWarnings("rawtypes")
   private final EventHandler eventHandler;
   private final AppContext context;
+  private final ConcurrentHashMap<ContainerId, AMContainer>containerMap;
 
   @SuppressWarnings("rawtypes")
   public AMContainerMap(ContainerHeartbeatHandler chh, TaskAttemptListener tal,
       EventHandler eventHandler, AppContext context) {
+    super("AMContainerMaps");
     this.chh = chh;
     this.tal = tal;
     this.eventHandler = eventHandler;
     this.context = context;
+    this.containerMap = new ConcurrentHashMap<ContainerId, AMContainer>();
   }
 
   @Override
   public void handle(AMContainerEvent event) {
     ContainerId containerId = event.getContainerId();
-    get(containerId).handle(event);
+    containerMap.get(containerId).handle(event);
   }
 
   public void addNewContainer(Container container) {
     AMContainer amc = new AMContainerImpl(container, chh, tal, eventHandler,
         context);
-    put(container.getId(), amc);
+    containerMap.put(container.getId(), amc);
+  }
+  
+  public AMContainer get(ContainerId containerId) {
+    return containerMap.get(containerId);
+  }
+  
+  public Collection<AMContainer>values() {
+    return containerMap.values();
   }
 }
\ No newline at end of file



Mime
View raw message