You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Payne, Greg (Contractor)" <gr...@xo.com> on 2005/04/07 18:14:01 UTC

[Configuration] FileChangedReloadingStrategy not working as expected

I am trying to use FileChangedReloadingStrategy to refresh my config
object and I can't get it to work. Here is my code...

config = new XMLConfiguration(CONFIG_FILE_NAME);
strategy = new FileChangedReloadingStrategy();
config.setReloadingStrategy(strategy);

When I modify the config file and call 
config.getString("prop1");
I get the old value.

If I call strategy.reloadingRequired() it does return true but then if I
call config.load() I still get the old value. The only way I can get the
new value is to re-instantiate XMLConfiguration with the three lines
above. 

Am I correct in assuming that I should not have to check
reloadingRequired() or do a manual reload -  that if the file is
changed, a call to config.getString() should get the new value? I
suspect the fact that config.load() doesn't seem to work might be at the
root of the problem - that the library actually does do this when the
file is changed but it just doesn't work.

I even tried adding strategy.init() and
strategy.setConfiguration(config) but it didn't help. What am I doing
wrong?

Thanks in advance,
Greg