YARN-6327. Removing queues from CapacitySchedulerQueueManager and ParentQueue should be done with iterator. Contributed by Jonathan Hung.

This commit is contained in:
Naganarasimha 2017-03-15 01:22:25 +05:30
parent 7515e75103
commit 0a3aa40fe7
2 changed files with 9 additions and 4 deletions

View File

@ -22,6 +22,7 @@
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -312,10 +313,12 @@ private void updateQueues(Map<String, CSQueue> existingQueues,
existingQueues.put(queueName, queue);
}
}
for (Map.Entry<String, CSQueue> e : existingQueues.entrySet()) {
for (Iterator<Map.Entry<String, CSQueue>> itr = existingQueues.entrySet()
.iterator(); itr.hasNext();) {
Map.Entry<String, CSQueue> e = itr.next();
String queueName = e.getKey();
if (!newQueues.containsKey(queueName)) {
existingQueues.remove(queueName);
itr.remove();
}
}
}

View File

@ -333,10 +333,12 @@ public void reinitialize(CSQueue newlyParsedQueue,
}
// remove the deleted queue in the refreshed xml.
for (Map.Entry<String, CSQueue> e : currentChildQueues.entrySet()) {
for (Iterator<Map.Entry<String, CSQueue>> itr = currentChildQueues
.entrySet().iterator(); itr.hasNext();) {
Map.Entry<String, CSQueue> e = itr.next();
String queueName = e.getKey();
if (!newChildQueues.containsKey(queueName)) {
currentChildQueues.remove(queueName);
itr.remove();
}
}