|
37 | 37 | import org.apache.commons.configuration2.Configuration; |
38 | 38 | import org.apache.commons.configuration2.PropertiesConfiguration; |
39 | 39 | import org.apache.commons.configuration2.SubsetConfiguration; |
40 | | -import org.apache.commons.configuration2.builder.fluent.Configurations; |
41 | | -import org.apache.commons.configuration2.builder.fluent.Parameters; |
42 | | -import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler; |
43 | 40 | import org.apache.commons.configuration2.ex.ConfigurationException; |
| 41 | +import org.apache.commons.configuration2.io.FileHandler; |
44 | 42 | import org.apache.hadoop.metrics2.MetricsFilter; |
45 | 43 | import org.apache.hadoop.metrics2.MetricsPlugin; |
46 | 44 | import org.apache.hadoop.metrics2.filter.GlobFilter; |
@@ -112,14 +110,15 @@ static MetricsConfig create(String prefix, String... fileNames) { |
112 | 110 | static MetricsConfig loadFirst(String prefix, String... fileNames) { |
113 | 111 | for (String fname : fileNames) { |
114 | 112 | try { |
115 | | - Configuration cf = new Configurations().propertiesBuilder(fname) |
116 | | - .configure(new Parameters().properties() |
117 | | - .setFileName(fname) |
118 | | - .setListDelimiterHandler(new DefaultListDelimiterHandler(','))) |
119 | | - .getConfiguration() |
120 | | - .interpolatedConfiguration(); |
121 | | - LOG.info("loaded properties from "+ fname); |
122 | | - LOG.debug(toString(cf)); |
| 113 | + PropertiesConfiguration pcf = new PropertiesConfiguration(); |
| 114 | + FileHandler fh = new FileHandler(pcf); |
| 115 | + fh.setFileName(fname); |
| 116 | + fh.load(); |
| 117 | + Configuration cf = pcf.interpolatedConfiguration(); |
| 118 | + LOG.info("Loaded properties from {}", fname); |
| 119 | + if (LOG.isDebugEnabled()) { |
| 120 | + LOG.debug("Properties: {}", toString(cf)); |
| 121 | + } |
123 | 122 | MetricsConfig mc = new MetricsConfig(cf, prefix); |
124 | 123 | LOG.debug(mc.toString()); |
125 | 124 | return mc; |
|
0 commit comments