hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aajis...@apache.org
Subject hadoop git commit: HADOOP-11586. Update use of Iterator to Iterable in AbstractMetricsContext.java. Contributed by Ray Chiang.
Date Thu, 12 Feb 2015 22:43:15 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 380cc4dbe -> 7d6c3c6db


HADOOP-11586. Update use of Iterator to Iterable in AbstractMetricsContext.java. Contributed
by Ray Chiang.

(cherry picked from commit 11d8934463fca00db225a1c7660e0815832352d8)


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

Branch: refs/heads/branch-2
Commit: 7d6c3c6dbe111e4d5784671640aab31a2e427d57
Parents: 380cc4d
Author: Akira Ajisaka <aajisaka@apache.org>
Authored: Thu Feb 12 14:41:03 2015 -0800
Committer: Akira Ajisaka <aajisaka@apache.org>
Committed: Thu Feb 12 14:42:10 2015 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt         |  3 +++
 .../hadoop/metrics/spi/AbstractMetricsContext.java      | 12 ++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/7d6c3c6d/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 25b5731..e8437ac 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -191,6 +191,9 @@ Release 2.7.0 - UNRELEASED
     HADOOP-11543. Improve help message for hadoop/yarn command. (Brahma 
     Reddy Battula via ozawa).
 
+    HADOOP-11586. Update use of Iterator to Iterable in
+    AbstractMetricsContext.java. (Ray Chiang via aajisaka)
+
   OPTIMIZATIONS
 
     HADOOP-11323. WritableComparator#compare keeps reference to byte array.

http://git-wip-us.apache.org/repos/asf/hadoop/blob/7d6c3c6d/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
index 6e1e210..e71cbfe 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java
@@ -310,13 +310,13 @@ public abstract class AbstractMetricsContext implements MetricsContext
{
    *  Emits the records.
    */
   private synchronized void emitRecords() throws IOException {
-    for (String recordName : bufferedData.keySet()) {
-      RecordMap recordMap = bufferedData.get(recordName);
+    for (Map.Entry<String,RecordMap> recordEntry : bufferedData.entrySet()) {
+      RecordMap recordMap = recordEntry.getValue();
       synchronized (recordMap) {
         Set<Entry<TagMap, MetricMap>> entrySet = recordMap.entrySet ();
         for (Entry<TagMap, MetricMap> entry : entrySet) {
           OutputRecord outRec = new OutputRecord(entry.getKey(), entry.getValue());
-          emitRecord(contextName, recordName, outRec);
+          emitRecord(contextName, recordEntry.getKey(), outRec);
         }
       }
     }
@@ -330,8 +330,8 @@ public abstract class AbstractMetricsContext implements MetricsContext
{
    */
   public synchronized Map<String, Collection<OutputRecord>> getAllRecords() {
     Map<String, Collection<OutputRecord>> out = new TreeMap<String, Collection<OutputRecord>>();
-    for (String recordName : bufferedData.keySet()) {
-      RecordMap recordMap = bufferedData.get(recordName);
+    for (Map.Entry<String,RecordMap> recordEntry : bufferedData.entrySet()) {
+      RecordMap recordMap = recordEntry.getValue();
       synchronized (recordMap) {
         List<OutputRecord> records = new ArrayList<OutputRecord>();
         Set<Entry<TagMap, MetricMap>> entrySet = recordMap.entrySet();
@@ -339,7 +339,7 @@ public abstract class AbstractMetricsContext implements MetricsContext
{
           OutputRecord outRec = new OutputRecord(entry.getKey(), entry.getValue());
           records.add(outRec);
         }
-        out.put(recordName, records);
+        out.put(recordEntry.getKey(), records);
       }
     }
     return out;


Mime
View raw message