YARN-6327. Removing queues from CapacitySchedulerQueueManager and ParentQueue should be done with iterator. Contributed by Jonathan Hung.
This commit is contained in:
parent
7515e75103
commit
0a3aa40fe7
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user