Commons Configuration
  1. Commons Configuration

FileChangedReloadingStrategy not working for SubnodeConfiguration with a CombinedConfiguration parent


    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.6
    • Component/s: File reloading
    • Labels:


      A SubnodeConfiguration that has a CombinedConfiguration as its parent, doesn't "hot" reload properties even if the combined configuration consists of XMLConfigurations that have the FileChangedReloadingStrategy set, the combined configuration has the setForceReloadCheck flag set and the SubnodeConfiguration was obtained by calling configurationAt method and passing in true for the "supportUpdates" flag.

      Here's some code that shows the problem where the final assertion will fail.

      public void testSubnodeReadload() throws ConfigurationException

      { XMLConfiguration xmlConfiguration = new XMLConfiguration("service.xml"); FileChangedReloadingStrategy fileReloadStrategy = new FileChangedReloadingStrategy(); fileReloadStrategy.setRefreshDelay(1000); xmlConfiguration.setReloadingStrategy(fileReloadStrategy); XMLConfiguration config2 = new XMLConfiguration("environment.xml"); FileChangedReloadingStrategy fileReloadStrategy2 = new FileChangedReloadingStrategy(); fileReloadStrategy2.setRefreshDelay(1000); xmlConfiguration.setReloadingStrategy(fileReloadStrategy2); CombinedConfiguration combinedConfig = new CombinedConfiguration(); combinedConfig.setForceReloadCheck(true); combinedConfig.addConfiguration(xmlConfiguration); combinedConfig.addConfiguration(config2); int queue0threads2 = xmlConfiguration.getInt("messaging-new.queue(0).threads"); assert 2 == queue0threads2; //change the value in service.xml to 4 int queue0threads4 = xmlConfiguration.getInt("messaging-new.queue(0).threads"); assert 4 == queue0threads4; SubnodeConfiguration subConfigHier = xmlConfiguration.configurationAt("messaging-new.queue(0)", true); int queue0threadsCombinedSub4 = subConfigHier.getInt("threads"); assert queue0threadsCombinedSub4 == 4; //change the value service.xml to 8 int queue0threadsCombinedSub8 = subConfigHier.getInt("threads"); assert queue0threadsCombinedSub8 == 8; SubnodeConfiguration subNodeConfigParentIsCombinedConfig = combinedConfig.configurationAt("messaging-new.queue(0)", true); int queue0threadsSub8 = subNodeConfigParentIsCombinedConfig.getInt("threads"); assert queue0threadsSub8 == 8; //change the value service.xml file to 16 int queue0threadsSub16 = subNodeConfigParentIsCombinedConfig.getInt("threads"); assert queue0threadsSub16 == 16; //THIS TEST FAILS }


        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        3d 58m 1 Oliver Heger 20/Oct/08 19:57
        Resolved Resolved Closed Closed
        305d 23h 39m 1 Oliver Heger 22/Aug/09 19:36
        Oliver Heger made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Oliver Heger made changes -
        Fix Version/s 1.6 [ 12312450 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Oliver Heger added a comment -

        A fix was applied to trunk and to the configuration2 branch.

        Oliver Heger added a comment - A fix was applied to trunk and to the configuration2 branch.
        Oliver Heger made changes -
        Field Original Value New Value
        Assignee Oliver Heger [ ]
        Brian Pugh created issue -


          • Assignee:
            Oliver Heger
            Brian Pugh
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: