You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2005/04/04 16:09:54 UTC
DO NOT REPLY [Bug 34289] New: -
FileChangedReloadingStrategy fails to properly detect file change
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
Summary: FileChangedReloadingStrategy fails to properly detect
file change
Product: Commons
Version: 1.1 Final
Platform: Other
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Configuration
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: eric.lee@genworth.com
Two code examples that fail to detect / load file changes:
=============================================================================Sample
1: If properties file location is determined by searching the classpath,
changes are not detected.
try {
PropertiesConfiguration propConfig = new
PropertiesConfiguration("commons.properties");
FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy();
strategy.setConfiguration(propConfig);
strategy.setRefreshDelay(500);
strategy.init();
for (;;){
String prop1 = propConfig.getString("prop1");
System.out.println(Calendar.getInstance().getTime() + " : " +
strategy.reloadingRequired() + " : " + prop1);
Thread.sleep(1000);
}
} catch (Throwable t){
t.printStackTrace();
}
=============================================================================
Sample 2: If properties file location is specified, changes are not detected
but not loaded.
try {
PropertiesConfiguration propConfig = new
PropertiesConfiguration("d:/tmp/commons.properties");
FileChangedReloadingStrategy strategy = new FileChangedReloadingStrategy();
strategy.setConfiguration(propConfig);
strategy.setRefreshDelay(500);
strategy.init();
for (;;){
String prop1 = propConfig.getString("prop1");
System.out.println(Calendar.getInstance().getTime() + " : " +
strategy.reloadingRequired() + " : " + prop1);
Thread.sleep(1000);
}
} catch (Throwable t){
t.printStackTrace();
}
--
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