Hi,

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" ?>

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

and the referenced file "test.properties" contains:
a=a
b=b
c=c

I asked this question, because with the first call of getConfiguration the "test.properties"-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" properties.

Thanks
  Stefan


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to