1)private boolean quietmode = true;
设置加载的配置模式,默认为 true,加载解析配置文件的过程中不会打印日志。开发人员的调试变量。
2)private ArrayList<Resource> resources = new ArrayList<Resource>();
保存了addResource() 方法添加 Configuration 对象的资源。有以下几种形式:
#CLASSPATH 资源
public void addResource(String name) {
addResourceObject(new Resource(name));
}
#URL地址
public void addResource(URL url) {
addResourceObject(new Resource(url));
}
#配置文件路径
public void addResource(Path file) {
addResourceObject(new Resource(file));
}
#输入流
public void addResource(InputStream in) {
addResourceObject(new Resource(in));
}
public void addResource(InputStream in, String name) {
addResourceObject(new Resource(in, name));
}
#Configuration 对象
public void addResource(Configuration conf) {
addResourceObject(new Resource(conf.getProps()));
}
3)private Set<String> finalParameters = Collections.newSetFromMap(
new ConcurrentHashMap<String, Boolean>());
标记为最终的配置参数参数列表
4)private boolean loadDefaults = true;
用于确定是否加载默认资源,这些默认资源保存在 defaultResources 中。defaultResources 是静态成员变量,通过 addDefaultResource 添加系统默认资源--hdfs-site.xml、core-site.xml等如:
static{
//print deprecation warning if hadoop-site.xml is found in classpath
ClassLoader cL = Thread.currentThread().getContextClassLoader();
if (cL == null) {
cL = Configuration.class.getClassLoader();
}
if(cL.getResource("hadoop-site.xml")!=null) {
LOG.warn("xxx");
}
addDefaultResource("core-default.xml");
addDefaultResource("core-site.xml");
}
5)private Map<String, String[]> updatingResource;
存储最近修改的 resource
6)private Properties properties; 7)private Properties overlay;
类型都是 java.util.Properties 配置文件解析出的键-值对。
8)private Set<String> finalParameters = Collections.newSetFromMap( new ConcurrentHashMap<String, Boolean>());
存储配置文件中申明为 final 类型的键-值对
9)private ClassLoader classLoader;
类加载器,可以加载指定类或者相关资源