1

I've two questions about archaius:

1) Can I change the value of one property inside a local properties file using archaius? - I think i must do that manually without archaius.

2) When I've manually changed the value of my property inside my properties file, can I force archaius to reload properties immediatly? My code is editing property file and then give as user response the property value but archaius does not refresh it's value immediatly using DynamicPreperty.

thanks in advance

Robboso
  • 15
  • 5

1 Answers1

0

You can reload the configurations when you have installed DynamicConfiguration using ConfigurationManager.install. In this case, you can reload using stop and start.

public void refresh() {
    List<AbstractConfiguration> configurations = finalConfig.getConfigurations();
    for (AbstractConfiguration configuration : configurations) {
        if (configuration instanceof DynamicConfiguration) {
            DynamicConfiguration dynamicConfiguration = DynamicConfiguration.class.cast(configuration);
            PolledConfigurationSource source = dynamicConfiguration.getSource();
            dynamicConfiguration.stopLoading();
            dynamicConfiguration.startPolling(source, new FixedDelayPollingScheduler(0, TEN_MINUTES, true));
        }
    }
}
SudhirR
  • 760
  • 4
  • 11