HADOOP-15549. Upgrade to commons-configuration 2.1 regresses task CPU consumption.
Contributed by Todd Lipcon.
This commit is contained in:
parent
41bdcf4110
commit
1f21be2d02
|
@ -37,10 +37,8 @@ import com.google.common.collect.Maps;
|
||||||
import org.apache.commons.configuration2.Configuration;
|
import org.apache.commons.configuration2.Configuration;
|
||||||
import org.apache.commons.configuration2.PropertiesConfiguration;
|
import org.apache.commons.configuration2.PropertiesConfiguration;
|
||||||
import org.apache.commons.configuration2.SubsetConfiguration;
|
import org.apache.commons.configuration2.SubsetConfiguration;
|
||||||
import org.apache.commons.configuration2.builder.fluent.Configurations;
|
|
||||||
import org.apache.commons.configuration2.builder.fluent.Parameters;
|
|
||||||
import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler;
|
|
||||||
import org.apache.commons.configuration2.ex.ConfigurationException;
|
import org.apache.commons.configuration2.ex.ConfigurationException;
|
||||||
|
import org.apache.commons.configuration2.io.FileHandler;
|
||||||
import org.apache.hadoop.metrics2.MetricsFilter;
|
import org.apache.hadoop.metrics2.MetricsFilter;
|
||||||
import org.apache.hadoop.metrics2.MetricsPlugin;
|
import org.apache.hadoop.metrics2.MetricsPlugin;
|
||||||
import org.apache.hadoop.metrics2.filter.GlobFilter;
|
import org.apache.hadoop.metrics2.filter.GlobFilter;
|
||||||
|
@ -112,12 +110,11 @@ class MetricsConfig extends SubsetConfiguration {
|
||||||
static MetricsConfig loadFirst(String prefix, String... fileNames) {
|
static MetricsConfig loadFirst(String prefix, String... fileNames) {
|
||||||
for (String fname : fileNames) {
|
for (String fname : fileNames) {
|
||||||
try {
|
try {
|
||||||
Configuration cf = new Configurations().propertiesBuilder(fname)
|
PropertiesConfiguration pcf = new PropertiesConfiguration();
|
||||||
.configure(new Parameters().properties()
|
FileHandler fh = new FileHandler(pcf);
|
||||||
.setFileName(fname)
|
fh.setFileName(fname);
|
||||||
.setListDelimiterHandler(new DefaultListDelimiterHandler(',')))
|
fh.load();
|
||||||
.getConfiguration()
|
Configuration cf = pcf.interpolatedConfiguration();
|
||||||
.interpolatedConfiguration();
|
|
||||||
LOG.info("loaded properties from "+ fname);
|
LOG.info("loaded properties from "+ fname);
|
||||||
LOG.debug(toString(cf));
|
LOG.debug(toString(cf));
|
||||||
MetricsConfig mc = new MetricsConfig(cf, prefix);
|
MetricsConfig mc = new MetricsConfig(cf, prefix);
|
||||||
|
|
Loading…
Reference in New Issue