commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (JIRA)" <j...@apache.org>
Subject [jira] Reopened: (CONFIGURATION-50) [configuration] FileChangedReloadingStrategy fails to properly detect file change
Date Tue, 10 Apr 2007 14:36:33 GMT

     [ https://issues.apache.org/jira/browse/CONFIGURATION-50?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Emmanuel Bourg reopened CONFIGURATION-50:
-----------------------------------------


> [configuration] FileChangedReloadingStrategy fails to properly detect file change
> ---------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-50
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-50
>             Project: Commons Configuration
>          Issue Type: Bug
>    Affects Versions: 1.1
>         Environment: Operating System: Windows XP
> Platform: Other
>            Reporter: Eric Lee
>         Attachments: ConfigurationChangedReloadingStrategy.java, ConfigurationUtils.java.patch,
patch.diff, patch.diff
>
>
> 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();
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
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