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

DatabaseConfiguration doesn't reload from database.

    XMLWordPrintableJSON

Details

    • Patch, Important

    Description

      Hi,

      I have successfully setup Apache configuration to read from a database table by using DatabaseConfigurationProvider. However when I change the database property in the DB table and read the property again, it always has the previous value and not the updated value from Table.

      My code is:

      Setup:
      DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder(propFileUrl);
      DefaultConfigurationBuilder.ConfigurationProvider provider = new DatabaseConfigurationProvider();
      builder.addConfigurationProvider("database", provider);
      ReloadingStrategy strategy = new FileChangedReloadingStrategy();
      ((FileChangedReloadingStrategy) strategy).setRefreshDelay(5000);
      builder.setReloadingStrategy(strategy);
      combinedConfig = builder.getConfiguration(true);

      Config.xml:

      <configuration>
      <database jndi="jdbc/semsDs" table="CSW_APPL_PROPERTIES" keyColumn="PROP_NAME" valueColumn="PROP_VALUE"/>
      </configuration>

      To access table property:
      String dbProp = combinedConfig.getString("TEST_PROP");

      Steps to recreate:

      1) Setup Apache database configuration as above.
      2) Access the property from DB table TEST_PROP=TEMP_1
      3) Now change the TEST_PROP value to TEMP_2 in the DB table.
      4) Access the property from the same DB Table.
      5) Property Value still says TEMP_1.

      Attachments

        Activity

          People

            Unassigned Unassigned
            chethanjs Chethan Shankar_apache
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified