9uapaw commented on a change in pull request #3361:
URL: https://github.com/apache/hadoop/pull/3361#discussion_r703019369



##########
File path: 
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/AbstractManagedParentQueue.java
##########
@@ -173,50 +168,31 @@ public AutoCreatedLeafQueueConfig getLeafQueueTemplate() {
     return queueManagementPolicy;
   }
 
-  protected SortedMap<String, String> getConfigurationsWithPrefix
-      (SortedMap<String, String> sortedConfigs, String prefix) {
-    return sortedConfigs.subMap( prefix, prefix + Character.MAX_VALUE );
-  }
-
-  protected SortedMap<String, String> sortCSConfigurations() {
-    SortedMap<String, String> sortedConfigs = new TreeMap(
-        new Comparator<String>() {
-          public int compare(String s1, String s2) {
-            return s1.compareToIgnoreCase(s2);
-          }
+  protected Map<String, String> getCSConfigurationsWithPrefix(String prefix) {
+    Map<String, String> configsWithPrefix = new HashMap<>();
 
-        });
-
-    for (final Iterator<Map.Entry<String, String>> iterator =
-         csContext.getConfiguration().iterator(); iterator.hasNext(); ) {
-      final Map.Entry<String, String> confKeyValuePair = iterator.next();
-      sortedConfigs.put(confKeyValuePair.getKey(), 
confKeyValuePair.getValue());
+    for (Map.Entry<String, String> confKeyValuePair :
+        csContext.getConfiguration().getPropsWithPrefix(prefix).entrySet()) {
+      configsWithPrefix.put(prefix + confKeyValuePair.getKey(), 
confKeyValuePair.getValue());
     }
-    return sortedConfigs;
+
+    return configsWithPrefix;
   }
 
-  protected CapacitySchedulerConfiguration initializeLeafQueueConfigs(String
-      configPrefix) {
+  protected CapacitySchedulerConfiguration initializeLeafQueueConfigs(String 
configPrefix) {
 
     CapacitySchedulerConfiguration leafQueueConfigs = new
-        CapacitySchedulerConfiguration(new Configuration(false), false);
+        CapacitySchedulerConfiguration(csContext.getConf(), false);

Review comment:
       I agree with @brumi1024 on this. We need to eliminate initializing an 
other configuration object, which is still happening in your current revision. 
My advise is to simply use csContext.getConfiguration to set the properties 
similar to AutoCreatedQueueTemplate class, as @brumi1024 suggested.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to