Repository: hadoop Updated Branches: refs/heads/trunk 89a544928 -> 76e309ead
MAPREDUCE-6253. Update use of Iterator to Iterable. Contributed by Ray Chiang. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/76e309ea Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/76e309ea Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/76e309ea Branch: refs/heads/trunk Commit: 76e309ead01f02b32335330cd920536f907fb71f Parents: 89a5449 Author: Devaraj K <deva...@apache.org> Authored: Thu Feb 12 13:45:19 2015 +0530 Committer: Devaraj K <deva...@apache.org> Committed: Thu Feb 12 13:45:19 2015 +0530 ---------------------------------------------------------------------- hadoop-mapreduce-project/CHANGES.txt | 2 ++ .../hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java | 7 +++---- .../src/main/java/org/apache/hadoop/mapred/QueueManager.java | 4 ++-- .../java/org/apache/hadoop/mapreduce/v2/hs/CompletedJob.java | 8 ++++---- 4 files changed, 11 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/76e309ea/hadoop-mapreduce-project/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 246f18d..145e99a 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -278,6 +278,8 @@ Release 2.7.0 - UNRELEASED MAPREDUCE-6227. DFSIO for truncate. (shv via yliu) + MAPREDUCE-6253. Update use of Iterator to Iterable. (Ray Chiang via devaraj) + OPTIMIZATIONS MAPREDUCE-6169. MergeQueue should release reference to the current item http://git-wip-us.apache.org/repos/asf/hadoop/blob/76e309ea/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java index 97de8fa..aad63d3 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/jobhistory/JobHistoryEventHandler.java @@ -374,11 +374,10 @@ public class JobHistoryEventHandler extends AbstractService // Process JobUnsuccessfulCompletionEvent for jobIds which still haven't // closed their event writers - Iterator<JobId> jobIt = fileMap.keySet().iterator(); if(forceJobCompletion) { - while (jobIt.hasNext()) { - JobId toClose = jobIt.next(); - MetaInfo mi = fileMap.get(toClose); + for (Map.Entry<JobId,MetaInfo> jobIt : fileMap.entrySet()) { + JobId toClose = jobIt.getKey(); + MetaInfo mi = jobIt.getValue(); if(mi != null && mi.isWriterActive()) { LOG.warn("Found jobId " + toClose + " to have not been closed. Will close"); http://git-wip-us.apache.org/repos/asf/hadoop/blob/76e309ea/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/QueueManager.java ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/QueueManager.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/QueueManager.java index 14934b9..39fae2a 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/QueueManager.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/QueueManager.java @@ -441,8 +441,8 @@ public class QueueManager { synchronized Map<String, JobQueueInfo> getJobQueueInfoMapping() { Map<String, JobQueueInfo> m = new HashMap<String, JobQueueInfo>(); - for (String key : allQueues.keySet()) { - m.put(key, allQueues.get(key).getJobQueueInfo()); + for (Map.Entry<String,Queue> entry : allQueues.entrySet()) { + m.put(entry.getKey(), entry.getValue().getJobQueueInfo()); } return m; http://git-wip-us.apache.org/repos/asf/hadoop/blob/76e309ea/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedJob.java ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedJob.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedJob.java index 66c44c8..1cf63d4 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedJob.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/CompletedJob.java @@ -227,10 +227,10 @@ public class CompletedJob implements org.apache.hadoop.mapreduce.v2.app.job.Job completionEvents = new LinkedList<TaskAttemptCompletionEvent>(); List<TaskAttempt> allTaskAttempts = new LinkedList<TaskAttempt>(); int numMapAttempts = 0; - for (TaskId taskId : tasks.keySet()) { - Task task = tasks.get(taskId); - for (TaskAttemptId taskAttemptId : task.getAttempts().keySet()) { - TaskAttempt taskAttempt = task.getAttempts().get(taskAttemptId); + for (Map.Entry<TaskId,Task> taskEntry : tasks.entrySet()) { + Task task = taskEntry.getValue(); + for (Map.Entry<TaskAttemptId,TaskAttempt> taskAttemptEntry : task.getAttempts().entrySet()) { + TaskAttempt taskAttempt = taskAttemptEntry.getValue(); allTaskAttempts.add(taskAttempt); if (task.getType() == TaskType.MAP) { ++numMapAttempts;