commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <>
Subject Re: [Configuration] PropertiesConfiguration ReloadStrategy not working as expected
Date Fri, 20 May 2005 16:39:46 GMT
Hi Christian,

Christian Hufgard wrote:

>Hi everyone!
>Since yesterday I am a user of Configuration (1.1) - waited a long time for
>the release to replace the stuff I wrote for myself. I tried to replace my
>own properties handler with the one provided by Configuration.
>To to this, I created a PropertiesConfiguration the following way:
>PropertiesConfiguration propsConfig = 
>   new PropertiesConfiguration(propertiesFileName);
>reloading = new FileChangedReloadingStrategy();
>propertiesFileName is the name of a properties-file that can be found in the
>shared/classes directory of my tomcat. Loading the properties from there
>worked fine. But the reloading did not work.
>So I took a look into the code and found out, that the
>FileChangedReloadingStrategy does not observe the right file. It was looking
>just for the filename without any basepath.
>When I instantiate the ReloadingStrategy with a complete path it works the
>way it should. Is this behaviour intended?
Certainly not. There are some problems related to locating files and the 
reloading mechanism. You might want to check out the bug reports in 
bugzilla (just enter [configuration] as search expression). A few issues 
have already been fixed, so you could give the latest nightly builds a try.

>Also I would like to diskuss some features, which I am misssing.
>First is the possibility to inform classes about a change at the properties,
>which I need for at leat one class, that has some cron-like job. I wrote a
>subclass of FileChangedReloadingStrategy that informs Listeners about
>changes at the properties. Would something like this be usefull for someone
>Think a periodically checking of the properties the way log4j does it, would
>also be nice to retrieve information independent to a user interacting with
>the system.
>Is this planned for Version 1.3? Task: observable configurations?
Observable configurations in the first line meant that you can register 
some listener at a configuration that will be notified about changes at 
its properties. So events will be fired e.g. when setProperty() or 
clearProperty() will be called on this configuration. IIUYC you register 
your listeners at the reloading strategy.

I think this is very interesting. But if you want the reloading strategy 
perform periodic checks, doesn't this enforce the construction of a 
thread? This could be quite problematic in some environments (J2EE).

>The other is the possibility to use the ConfigurationFactory in combination
>with a ReloadingStrategy. I want to read the configuration details from a
>xml file with
>ConfigurationFactory factory = new ConfigurationFactory("config.xml");
>Configuration config = factory.getConfiguration();
>to have a flexibel way to change it, but do not want to loose the chance to
>get informed if the config changes. Is a feature like this planned for
>future releases?
For ConfigurationFactory a major refactoring is planned. This would be a 
good opportunity to add such a feature. In the long term I would like to 
have a more general reloading mechanism. ATM only file based 
configurations are supported. But I am not sure yet how this could look 


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

View raw message