HADOOP-14213. Move Configuration runtime check for hadoop-site.xml to initialization. Contributed by Jonathan Eagles

(cherry picked from commit 595f62e362)
This commit is contained in:
Ravi Prakash 2017-03-23 09:28:10 -07:00
parent 20878d052c
commit 87339d7691
1 changed files with 8 additions and 10 deletions

View File

@ -656,6 +656,10 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
}
static {
// Add default resources
addDefaultResource("core-default.xml");
addDefaultResource("core-site.xml");
// print deprecation warning if hadoop-site.xml is found in classpath
ClassLoader cL = Thread.currentThread().getContextClassLoader();
if (cL == null) {
@ -667,9 +671,8 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
+ "mapred-site.xml and hdfs-site.xml to override properties of " +
"core-default.xml, mapred-default.xml and hdfs-default.xml " +
"respectively");
addDefaultResource("hadoop-site.xml");
}
addDefaultResource("core-default.xml");
addDefaultResource("core-site.xml");
}
private Properties properties;
@ -2557,11 +2560,6 @@ public class Configuration implements Iterable<Map.Entry<String,String>>,
for (String resource : defaultResources) {
loadResource(properties, new Resource(resource), quiet);
}
//support the hadoop-site.xml as a deprecated case
if(getResource("hadoop-site.xml")!=null) {
loadResource(properties, new Resource("hadoop-site.xml"), quiet);
}
}
for (int i = 0; i < resources.size(); i++) {