commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <oliver.he...@oliver-heger.de>
Subject Re: detecting file reload in Apache Commons Configuration2
Date Sat, 03 Dec 2016 15:21:37 GMT


Am 03.12.2016 um 16:15 schrieb Garret Wilson:
> On 12/3/2016 9:09 AM, Oliver Heger wrote:
>> ...
>> You can add an event listener at the ReloadingController, then you
>> receive notifications of type ReloadingEvent.
> 
> But how does that help me? The Javadocs for
> [ReloadingEvent](https://commons.apache.org/proper/commons-configuration/apidocs/org/apache/commons/configuration2/reloading/ReloadingEvent.html)
> says that this is an "event that is fired when a reload operation is
> required." I don't want an event just when a reload is _required_. That
> helps the ReloadingController, but doesn't help my application much. I
> want an event when a reload _has occurred_, that is, I'm guaranteed that
> the configuration now has new information.
> 
>> Alternatively, you could also register a more generic listener for
>> events on the configuration builder itself. When the builder's managed
>> configuration is reset, a corresponding event is produced. This also
>> happens during a reload operation.
> 
> Does it happen _during_ a reload operation or _after_? When I receive
> this event, is the configuration guaranteed to have the new, reloaded
> information?
> 
> Why can't I just have a simple event saying "the configuration now has
> new data"?

Maybe a misunderstanding of the reloading mechanism: New data is not
automatically pushed into a Configuration object you might have a
reference to. Rather, the configuration builder is reset. So the next
time you query the builder for a configuration you get a new one with
updated data.

When you receive one of the mentioned events the builder has been reset
and thus you know that new data is available.

Oliver

> 
> Garret
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 

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


Mime
View raw message