Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.1
-
None
-
None
-
Operating System: Windows XP
Platform: Other
-
34289
Description
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(); }