You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Emmanuel Bourg (JIRA)" <ji...@apache.org> on 2007/04/10 16:34:32 UTC
[jira] Closed: (CONFIGURATION-50) [configuration]
FileChangedReloadingStrategy fails to properly detect file change
[ https://issues.apache.org/jira/browse/CONFIGURATION-50?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Emmanuel Bourg closed 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