You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Roger L. Whitcomb" <Ro...@actian.com> on 2013/03/01 20:01:36 UTC

ListenerList question

So, in the process of rewriting the base ListenerList implementation to
reduce the amount of memory thrashing that we have been seeing, I saw
(while I (briefly) used java.util.ArrayList to implement it) that we
frequently and somewhat randomly get listeners added to the listener
lists while iterating through these lists.  I saw it with key events,
mouse events, and probably others as well.  The original implementation
and what is in there now do not care, but java.util.ArrayList did, and
was throwing ConcurrentModificationException a lot.

 

My question is:  do others know about this?  Is this expected?  Does
anyone think this might be dangerous or not good?  Or does anyone recall
why this is happening (I couldn't really see why, other than perhaps for
tooltips)?

 

Thanks,

~Roger Whitcomb

 


Re: ListenerList question

Posted by Sandro Martini <sa...@gmail.com>.
Hi Roger,

> My question is:  do others know about this?  Is this expected?  Does
> anyone think this might be dangerous or not good?  Or does anyone recall
> why this is happening (I couldn't really see why, other than perhaps for
> tooltips)?
no I'm sorry but I don't know real reasons for first write in that way
(other than maybe some memory saving using a Linked List, but for sure
not so much debug friendly), so to me your new implementation looks
good (even for the simplification of debugging).

On the (temporary) implementation using ArrayList as you I saw many
ConcurrentModificationException, so really I guess if some
synchronization on methods was missing for use that implementation,
but if possible I'd prefer to use another way ... like your last
implementation.

What others say ?

Bye,
Sandro