[
https://issues.apache.org/jira/browse/CONFIGURATION-596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14290778#comment-14290778
]
Oliver Heger commented on CONFIGURATION-596:
--------------------------------------------
Such error listeners are registered by configuration implementations which may
encounter exceptions on regular property access like {{DatabaseConfiguration}}
or {{JndiConfiguration}}.
I agree with most of your points, but for sure the lazy initialization adds
overhead to the runtime of regular configuration operations. For instance, each
time a property is added, an event is fired. This would mean an additional
check (which is somehow guarded by a *synchronized* block or a read to a
*volatile* field) to find out whether the event listeners collection is
initialized. There are some other places which have to be adapted as well, e.g.
cloning.
I am just not sure whether all this is worth the effort to avoid the memory
footprint of a collection object. If you deal with a somewhat larger set of
configuration properties, these extra bytes won't make such a big difference,
will they?
> Allow event listener Collections to be lazily created in event.EventSource
> --------------------------------------------------------------------------
>
> Key: CONFIGURATION-596
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-596
> Project: Commons Configuration
> Issue Type: Improvement
> Components: Events & Notifications
> Affects Versions: 1.9
> Reporter: Vladimir Sitnikov
> Attachments: CoWArrayList1.jpg,
> dataflow_commons_configuration_cowarraylist.png
>
>
> It turns out every instance of {{AbstractConfiguration}} creates a couple of
> {{CopyOnWriteAraryLists}} for {{event.EventSource}}.
> In our usage patterns in most of the cases the lists are not used.
> Can the lists be lazy-initialized? (that is created on the first addListener
> request)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)