Using `org.apache.commons:commons-configuration2:2.1` my application needs to know when a configuration file has been reloaded so that it can update some things in the program. Apache Commons Configuration2 uses a lot of strategies and factories, and usually that's great, but here it's getting so complicated I can't figure out where I need to install a listener.

The application has this:

configConfigurationBuilder = new ReloadingFileBasedConfigurationBuilder<FileBasedConfiguration>(
        PropertiesConfiguration.class)
.configure(new Parameters().properties().setFile(getConfigFile())); final PeriodicReloadingTrigger configReloadingTrigger = new PeriodicReloadingTrigger( configConfigurationBuilder.getReloadingController(), null, 1, TimeUnit.MINUTES);
    configReloadingTrigger.start();

Which of these various things can I install a listener on? I just want to be notified when the configuration file is reloaded.

I notice that the `ReloadingDetector` interface has a `reloadingPerformed()` method, and that sounds like what I want. But how do I add my own `ReloadingDetector`? It seems like the `ReloadingController` only keeps one `ReloadingDetector` around. Surely I don't have to subclass `ReloadingDetector` and install a custom one, would I? I'm not wanting to specialize the reloading detection, so subclassing would not be appropriate --- I just want to be notified when something happens. Besides, it's not obvious to me where I would even hook into the `ReloadingFileBasedConfigurationBuilder` chain of events where it uses some internal factor to create the detector.

So how can I easily get Apache Commons Configuration2 to notify me when it reloads a configuration?

Garret

P.S Does no one monitor Stack Overflow? It is a real pain to subscribe to this old-fashioned mailing list---a general one for all Apache Commons, at that!---just to ask a technical question. Below is the unanswered Stack Overflow question I posted.

http://stackoverflow.com/q/40917757/421049

If you were to answer this question on Stack Overflow it would help a lot more people than simply replying on this obscure mailing list. Just a suggestion.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to