commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dont_know <>
Subject [configuration] Calling getConfiguration on DefaultConfigurationBuilder more than once permitted
Date Fri, 21 Mar 2014 21:45:29 GMT

is it permitted to call getConfiguration more than once on the same 
instance of DefaultConfigurationBuilder like this:

DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
builder.setFile(new File("config.xml"));
Configuration config = builder.getConfiguration(true);
config = builder.getConfiguration(true);
config = builder.getConfiguration(true);

The config.xml looks like this:
<?xml version="1.0" encoding="ISO-8859-1" ?>

   <properties fileName="" config-at="a"/>
   <properties fileName="" config-at="b"/>
   <properties fileName="" config-at="c"/>
   <properties fileName="" config-at="d"/>
   <properties fileName="" config-at="e"/>
   <properties fileName="" config-at="f"/>
   <properties fileName="" config-at="g"/>
   <properties fileName="" config-at="h"/>
   <properties fileName="" config-at="i"/>
   <properties fileName="" config-at="j"/>

and the referenced file "" contains:

I asked this question, because with the first call of getConfiguration 
the ""-file is read 10 times (once for every 
"config-at"), with the second call 20 times, with the third call 30 
times and so on. So in the end the program slows down and after 100 
calls it needs 200ms to read the properties.

I'm a little bit confused because my idea was to instantiate 
DefaultConfigurationBuilder for performance reasons only once (as a 
Singleton) and call getConfiguration subsequently to read "fresh" 


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message