Uploaded image for project: 'Commons Configuration'
  1. Commons Configuration
  2. CONFIGURATION-50

[configuration] FileChangedReloadingStrategy fails to properly detect file change

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1
    • 1.2
    • 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(); }

      Attachments

        Activity

          People

            Unassigned Unassigned
            eric.lee@genworth.com Eric Lee
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: