hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xg...@apache.org
Subject hadoop git commit: YARN-3179. Update use of Iterator to Iterable in RMAdminCLI and CommonNodeLabelsManager. Contributed by Ray Chiang
Date Fri, 13 Feb 2015 01:33:13 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 5f0495689 -> df6bee5a7


YARN-3179. Update use of Iterator to Iterable in RMAdminCLI and
CommonNodeLabelsManager. Contributed by Ray Chiang

(cherry picked from commit 2586915bb3178d26ad692f93d53aaffbb55d9ed9)


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

Branch: refs/heads/branch-2
Commit: df6bee5a75d2a763addf4c108c680b609abdfa4d
Parents: 5f04956
Author: Xuan <xgong@apache.org>
Authored: Thu Feb 12 17:31:45 2015 -0800
Committer: Xuan <xgong@apache.org>
Committed: Thu Feb 12 17:32:58 2015 -0800

----------------------------------------------------------------------
 hadoop-yarn-project/CHANGES.txt                  |  3 +++
 .../hadoop/yarn/client/cli/RMAdminCLI.java       | 19 ++++++++++---------
 .../yarn/nodelabels/CommonNodeLabelsManager.java |  4 ++--
 3 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/df6bee5a/hadoop-yarn-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 9065164..5fb3ae1 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -251,6 +251,9 @@ Release 2.7.0 - UNRELEASED
     YARN-3158. Correct log messages in ResourceTrackerService.
     (Varun Saxena via xgong)
 
+    YARN-3179. Update use of Iterator to Iterable in RMAdminCLI and
+    CommonNodeLabelsManager. (Ray Chiang via xgong)
+
   OPTIMIZATIONS
 
     YARN-2990. FairScheduler's delay-scheduling always waits for node-local and 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/df6bee5a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java
index af83102..d29f674 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java
@@ -128,12 +128,12 @@ public class RMAdminCLI extends HAAdmin {
   }
 
   private static void appendHAUsage(final StringBuilder usageBuilder) {
-    for (String cmdKey : USAGE.keySet()) {
-      if (cmdKey.equals("-help")) {
+    for (Map.Entry<String,UsageInfo> cmdEntry : USAGE.entrySet()) {
+      if (cmdEntry.getKey().equals("-help")) {
         continue;
       }
-      UsageInfo usageInfo = USAGE.get(cmdKey);
-      usageBuilder.append(" [" + cmdKey + " " + usageInfo.args + "]");
+      UsageInfo usageInfo = cmdEntry.getValue();
+      usageBuilder.append(" [" + cmdEntry.getKey() + " " + usageInfo.args + "]");
     }
   }
 
@@ -173,14 +173,15 @@ public class RMAdminCLI extends HAAdmin {
   private static void buildUsageMsg(StringBuilder builder,
       boolean isHAEnabled) {
     builder.append("Usage: yarn rmadmin\n");
-    for (String cmdKey : ADMIN_USAGE.keySet()) {
-      UsageInfo usageInfo = ADMIN_USAGE.get(cmdKey);
-      builder.append("   " + cmdKey + " " + usageInfo.args + "\n");
+    for (Map.Entry<String,UsageInfo> cmdEntry : ADMIN_USAGE.entrySet()) {
+      UsageInfo usageInfo = cmdEntry.getValue();
+      builder.append("   " + cmdEntry.getKey() + " " + usageInfo.args + "\n");
     }
     if (isHAEnabled) {
-      for (String cmdKey : USAGE.keySet()) {
+      for (Map.Entry<String,UsageInfo> cmdEntry : USAGE.entrySet()) {
+        String cmdKey = cmdEntry.getKey();
         if (!cmdKey.equals("-help")) {
-          UsageInfo usageInfo = USAGE.get(cmdKey);
+          UsageInfo usageInfo = cmdEntry.getValue();
           builder.append("   " + cmdKey + " " + usageInfo.args + "\n");
         }
       }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/df6bee5a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/CommonNodeLabelsManager.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/CommonNodeLabelsManager.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/CommonNodeLabelsManager.java
index 25ff417..cb6f1f3 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/CommonNodeLabelsManager.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/nodelabels/CommonNodeLabelsManager.java
@@ -383,8 +383,8 @@ public class CommonNodeLabelsManager extends AbstractService {
   @SuppressWarnings("unchecked")
   protected void internalRemoveFromClusterNodeLabels(Collection<String> labelsToRemove)
{
     // remove labels from nodes
-    for (String nodeName : nodeCollections.keySet()) {
-      Host host = nodeCollections.get(nodeName);
+    for (Map.Entry<String,Host> nodeEntry : nodeCollections.entrySet()) {
+      Host host = nodeEntry.getValue();
       if (null != host) {
         host.labels.removeAll(labelsToRemove);
         for (Node nm : host.nms.values()) {


Mime
View raw message