YARN-3179. Update use of Iterator to Iterable in RMAdminCLI and

CommonNodeLabelsManager. Contributed by Ray Chiang
This commit is contained in:
Xuan 2015-02-12 17:31:45 -08:00
parent 99f6bd4f7a
commit 2586915bb3
3 changed files with 15 additions and 11 deletions

View File

@ -287,6 +287,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

View File

@ -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");
}
}

View File

@ -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()) {