commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bourg <>
Subject [configuration] Automatic reloading
Date Thu, 11 Dec 2003 16:26:36 GMT
Greetings, I'd like to contribute a slight modification to reload 
automatically a PropertiesConfiguration if the underlying .properties 
file has been changed. I had to implement this to prevent restarting my 
web application every time a configuration file is modified.

The auto reload mode is enabled by calling setAutoReload(true) on the 
PropertiesConfiguration instance. It's disabled by default. Every time a 
property is accessed with getXXX(key) the date of the file is checked 
and the configuration is reloaded if the previous date known is older. 
This check is executed only once every 5 seconds to prevent hammering 
the file system.

I'm attaching the patch and the modified files to this mail, all test 
cases passed successfully. I've also added a specific test case for the 
automatic reloading scenario.

Emmanuel Bourg

View raw message