[
https://issues.apache.org/jira/browse/CONFIGURATION-596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14290786#comment-14290786
]
Vladimir Sitnikov commented on CONFIGURATION-596:
-------------------------------------------------
{quote} event is fired{quote}
As a first step, we can make lazy only errorList. Not sure if our app can do
without "listeners".
Do you think errorList is used often?
{quote}read to a volatile field{quote}
This is performed inside COWList anyway, so I do not think marking errorList
(and even listeners field) as volatile would result in measurable overhead.
I assume the rate of "fireError" should be zero anyway.
No additional syncrhonization is required on a read/fire path.
{quote} these extra bytes won't make such a big difference, will they?
{quote}
They will. Empty COWList takes 88 bytes, so it us not like 2 bytes:
https://gist.github.com/vlsi/3afe92a7f6449cc1692d
I've raised the issue in c-i
(http://cs.oswego.edu/pipermail/concurrency-interest/2015-January/013871.html),
however I believe fix of errorList is helpful anyway.
> 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)