commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Payne, Greg \(Contractor\)" <greg.pa...@xo.com>
Subject [Configuration] FileChangedReloadingStrategy not working as expected
Date Thu, 07 Apr 2005 16:14:01 GMT
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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message