commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 34289] - [configuration] FileChangedReloadingStrategy fails to properly detect file change
Date Mon, 04 Apr 2005 17:24:20 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34289>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34289





------- Additional Comments From ebourg@apache.org  2005-04-04 19:24 -------
The strategy is already initialized by the configuration when
setReloadingStrategy is called, you don't need to call
strategy.setConfiguration() nor strategy.init().

Also I don't think this is the best example to test the strategy. Since the call
to getString() will generate a call to reloadingPerformed() if the file changed,
calling reloadingRequired() after that will return "false" most of the time,
unless the file changed between the two instructions.

So I suggest you try this instead:

PropertiesConfiguration config= new PropertiesConfiguration("commons.properties");
FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy();
strategy.setRefreshDelay(500);

config.setReloadingStrategy(strategy);

for (;;){
	System.out.println((new Date()) + " : " + strategy.reloadingRequired() + " : "
+ config.getString("prop1"));
	Thread.sleep(1000);
}


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message