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

[configuration] FileChangedReloadingStrategy fails to properly detect file change

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.2
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: Other

    • Bugzilla Id:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: