<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:www.nabble.com,2006:forum-2574</id>
	<title>Nabble - GlazedLists</title>
	<updated>2008-10-07T16:24:37Z</updated>
	<link rel="self" type="application/atom+xml" href="http://www.nabble.com/GlazedLists-f2574.xml" />
	<link rel="alternate" type="text/html" href="http://www.nabble.com/GlazedLists-f2574.html" />
	<subtitle type="html">Glazed Lists is a toolkit for list transformations. GlazedLists home is &lt;a href=&quot;http://www.publicobject.com/glazedlists/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.</subtitle>
	
<entry>
	<id>tag:www.nabble.com,2006:post-19869500</id>
	<title>Re: State of Delete Giving Deleted Object</title>
	<published>2008-10-07T16:24:37Z</published>
	<updated>2008-10-07T16:24:37Z</updated>
	<author>
		<name>James Lemieux</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;I&amp;#39;d give more info to the abstract methods, in case the concrete implementations need it:&lt;br&gt;&lt;br&gt;abstract void itemAdded(EventList&amp;lt;E&amp;gt; source, int index, E newValue);&lt;br&gt;abstract void itemRemoved(EventList&amp;lt;E&amp;gt; source, int index, E oldValue);&lt;br&gt;
abstract void itemUpdated(EventList&amp;lt;E&amp;gt; source, int index, E oldValue, E newValue);&lt;br&gt;&lt;br&gt;but otherwise, yeah, that&amp;#39;s what I was thinking.&lt;br&gt;&lt;br&gt;James&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Tue, Oct 7, 2008 at 3:31 PM, Sam Berlin &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19869500&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sberlin@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;Thanks very much for the answer, James, and also for the pointer to&lt;br&gt;
the calculations API. &amp;nbsp;Unfortunately this isn&amp;#39;t for use with&lt;br&gt;
calculations, so I can&amp;#39;t use that. &amp;nbsp;Off the top of my head, I can&lt;br&gt;
think of a simple AbstractListener that&amp;#39;s something like this:&lt;br&gt;
&lt;br&gt;
abstract AbstractListEventListener implements ListEventListener {&lt;br&gt;
 &amp;nbsp; private List items = new ArrayList();&lt;br&gt;
 &amp;nbsp; public void listChanged(ListEvent changes) {&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp;while(changes.next()) {&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int type = changes.getType();&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int idx = changes.getChangeIndex();&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; switch(type) {&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case ListEvent.INSERT:&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; items.add(idx , changes.getSourceList().get(idx);&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; itemAdded(items.get(idx));&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case ListEvent.DELETE:&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Object removed = items.remove(idx);&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;itemRemoved(removed);&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case ListEvent.UPDATE:&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;items.set(idx , changes.getSourceList().get(idx);&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;itemUpdated(items.get(idx));&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br&gt;
 &amp;nbsp; &amp;nbsp;}&lt;br&gt;
&lt;br&gt;
 &amp;nbsp; abstract void itemAdded(Object o);&lt;br&gt;
 &amp;nbsp; abstract void itemRemoved(Object o);&lt;br&gt;
 &amp;nbsp; abstract void itemUpdated(Object o);&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
Do you see any obvious problems with something like that?&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;&amp;nbsp;Sam&lt;br&gt;
&lt;/font&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;Wj3C7c&quot;&gt;&lt;br&gt;
On Tue, Oct 7, 2008 at 6:16 PM, James Lemieux &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19869500&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jplemieux@...&lt;/a&gt;&amp;gt; wrote:&lt;br&gt;
&amp;gt; At this point I&amp;#39;d call that work &amp;quot;stalled&amp;quot;. There are about 3 or 4 really&lt;br&gt;
&amp;gt; difficult EventLists that need serious rewrites to finish off this task.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; At this point I&amp;#39;d recommend that you consider writing a generic solution to&lt;br&gt;
&amp;gt; this problem in your own codebase. i.e. something like your own&lt;br&gt;
&amp;gt; AbstractListEventListener, or perhaps a ListEventSupport class, that manages&lt;br&gt;
&amp;gt; the cached List and provides the deleted / old value at a given index.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I realize that&amp;#39;s less than ideal, but unfortunately life is catching up to&lt;br&gt;
&amp;gt; the contributors a lot and we&amp;#39;re not finding as much time to dedicate to&lt;br&gt;
&amp;gt; this project. I do my best to help support what does exist, but it&amp;#39;s not&lt;br&gt;
&amp;gt; near what we used to do...&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; James&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; PS I&amp;#39;ll mention again that if any of this is in regards to computing a&lt;br&gt;
&amp;gt; single value from an EventList, you should seriously consider using the&lt;br&gt;
&amp;gt; Calculations API.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; James&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; On Tue, Oct 7, 2008 at 3:00 PM, Sam Berlin &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19869500&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sberlin@...&lt;/a&gt;&amp;gt; wrote:&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Hi All,&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; I was wondering, is there progress at all on the ListEvent.DELETE&lt;br&gt;
&amp;gt;&amp;gt; change providing the deleted item? &amp;nbsp;I continue to stumble across this&lt;br&gt;
&amp;gt;&amp;gt; while building ListEventListeners. &amp;nbsp;The workaround is always to build&lt;br&gt;
&amp;gt;&amp;gt; a cached copy of the list contents. &amp;nbsp;That workaround seems to be&lt;br&gt;
&amp;gt;&amp;gt; horribly inefficient in that every place that should just be listening&lt;br&gt;
&amp;gt;&amp;gt; on the list (and needs to update state based on removed objects) needs&lt;br&gt;
&amp;gt;&amp;gt; to keep a duplicate copy of the list.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Is there any automagical code that can provide the deleted item&lt;br&gt;
&amp;gt;&amp;gt; without having each listener keep its own internal state?&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Thanks much,&lt;br&gt;
&amp;gt;&amp;gt; &amp;nbsp;Sam&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; ---------------------------------------------------------------------&lt;br&gt;
&amp;gt;&amp;gt; To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19869500&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;&lt;br&gt;
&amp;gt;&amp;gt; For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19869500&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
---------------------------------------------------------------------&lt;br&gt;
To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19869500&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;&lt;br&gt;
For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19869500&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---User-f2578.html&quot; embed=&quot;fixTarget[2578]&quot; target=&quot;_top&quot; &gt;GlazedLists - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/State-of-Delete-Giving-Deleted-Object-tp19868272p19869500.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19868742</id>
	<title>Re: State of Delete Giving Deleted Object</title>
	<published>2008-10-07T15:31:21Z</published>
	<updated>2008-10-07T15:31:21Z</updated>
	<author>
		<name>Sam Berlin</name>
	</author>
	<content type="html">Thanks very much for the answer, James, and also for the pointer to
&lt;br&gt;the calculations API. &amp;nbsp;Unfortunately this isn't for use with
&lt;br&gt;calculations, so I can't use that. &amp;nbsp;Off the top of my head, I can
&lt;br&gt;think of a simple AbstractListener that's something like this:
&lt;br&gt;&lt;br&gt;abstract AbstractListEventListener implements ListEventListener {
&lt;br&gt;&amp;nbsp; &amp;nbsp;private List items = new ArrayList();
&lt;br&gt;&amp;nbsp; &amp;nbsp;public void listChanged(ListEvent changes) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; while(changes.next()) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int type = changes.getType();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;int idx = changes.getChangeIndex();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;switch(type) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case ListEvent.INSERT:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;items.add(idx , changes.getSourceList().get(idx);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;itemAdded(items.get(idx));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case ListEvent.DELETE:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Object removed = items.remove(idx);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; itemRemoved(removed);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case ListEvent.UPDATE:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; items.set(idx , changes.getSourceList().get(idx);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; itemUpdated(items.get(idx));
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; break;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;abstract void itemAdded(Object o);
&lt;br&gt;&amp;nbsp; &amp;nbsp;abstract void itemRemoved(Object o);
&lt;br&gt;&amp;nbsp; &amp;nbsp;abstract void itemUpdated(Object o);
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;Do you see any obvious problems with something like that?
&lt;br&gt;&lt;br&gt;Thanks,
&lt;br&gt;&amp;nbsp;Sam
&lt;br&gt;&lt;br&gt;On Tue, Oct 7, 2008 at 6:16 PM, James Lemieux &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19868742&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jplemieux@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; At this point I'd call that work &amp;quot;stalled&amp;quot;. There are about 3 or 4 really
&lt;br&gt;&amp;gt; difficult EventLists that need serious rewrites to finish off this task.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; At this point I'd recommend that you consider writing a generic solution to
&lt;br&gt;&amp;gt; this problem in your own codebase. i.e. something like your own
&lt;br&gt;&amp;gt; AbstractListEventListener, or perhaps a ListEventSupport class, that manages
&lt;br&gt;&amp;gt; the cached List and provides the deleted / old value at a given index.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I realize that's less than ideal, but unfortunately life is catching up to
&lt;br&gt;&amp;gt; the contributors a lot and we're not finding as much time to dedicate to
&lt;br&gt;&amp;gt; this project. I do my best to help support what does exist, but it's not
&lt;br&gt;&amp;gt; near what we used to do...
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; James
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; PS I'll mention again that if any of this is in regards to computing a
&lt;br&gt;&amp;gt; single value from an EventList, you should seriously consider using the
&lt;br&gt;&amp;gt; Calculations API.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; James
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Tue, Oct 7, 2008 at 3:00 PM, Sam Berlin &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19868742&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sberlin@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Hi All,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I was wondering, is there progress at all on the ListEvent.DELETE
&lt;br&gt;&amp;gt;&amp;gt; change providing the deleted item? &amp;nbsp;I continue to stumble across this
&lt;br&gt;&amp;gt;&amp;gt; while building ListEventListeners. &amp;nbsp;The workaround is always to build
&lt;br&gt;&amp;gt;&amp;gt; a cached copy of the list contents. &amp;nbsp;That workaround seems to be
&lt;br&gt;&amp;gt;&amp;gt; horribly inefficient in that every place that should just be listening
&lt;br&gt;&amp;gt;&amp;gt; on the list (and needs to update state based on removed objects) needs
&lt;br&gt;&amp;gt;&amp;gt; to keep a duplicate copy of the list.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Is there any automagical code that can provide the deleted item
&lt;br&gt;&amp;gt;&amp;gt; without having each listener keep its own internal state?
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Thanks much,
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;Sam
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt;&amp;gt; To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19868742&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt; For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19868742&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19868742&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;
&lt;br&gt;For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19868742&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---User-f2578.html&quot; embed=&quot;fixTarget[2578]&quot; target=&quot;_top&quot; &gt;GlazedLists - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/State-of-Delete-Giving-Deleted-Object-tp19868272p19868742.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19868546</id>
	<title>Re: State of Delete Giving Deleted Object</title>
	<published>2008-10-07T15:16:59Z</published>
	<updated>2008-10-07T15:16:59Z</updated>
	<author>
		<name>James Lemieux</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;At this point I&amp;#39;d call that work &amp;quot;stalled&amp;quot;. There are about 3 or 4 really difficult EventLists that need serious rewrites to finish off this task.&lt;br&gt;&lt;br&gt;At this point I&amp;#39;d recommend that you consider writing a generic solution to this problem in your own codebase. i.e. something like your own AbstractListEventListener, or perhaps a ListEventSupport class, that manages the cached List and provides the deleted / old value at a given index.&lt;br&gt;
&lt;br&gt;I realize that&amp;#39;s less than ideal, but unfortunately life is catching up to the contributors a lot and we&amp;#39;re not finding as much time to dedicate to this project. I do my best to help support what does exist, but it&amp;#39;s not near what we used to do...&lt;br&gt;
&lt;br&gt;James&lt;br&gt;&lt;br&gt;PS I&amp;#39;ll mention again that if any of this is in regards to computing a single value from an EventList, you should seriously consider using the Calculations API.&lt;br&gt;&lt;br&gt;James&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;
On Tue, Oct 7, 2008 at 3:00 PM, Sam Berlin &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19868546&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sberlin@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
Hi All,&lt;br&gt;
&lt;br&gt;
I was wondering, is there progress at all on the ListEvent.DELETE&lt;br&gt;
change providing the deleted item? &amp;nbsp;I continue to stumble across this&lt;br&gt;
while building ListEventListeners. &amp;nbsp;The workaround is always to build&lt;br&gt;
a cached copy of the list contents. &amp;nbsp;That workaround seems to be&lt;br&gt;
horribly inefficient in that every place that should just be listening&lt;br&gt;
on the list (and needs to update state based on removed objects) needs&lt;br&gt;
to keep a duplicate copy of the list.&lt;br&gt;
&lt;br&gt;
Is there any automagical code that can provide the deleted item&lt;br&gt;
without having each listener keep its own internal state?&lt;br&gt;
&lt;br&gt;
Thanks much,&lt;br&gt;
&amp;nbsp;Sam&lt;br&gt;
&lt;br&gt;
---------------------------------------------------------------------&lt;br&gt;
To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19868546&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;&lt;br&gt;
For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19868546&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---User-f2578.html&quot; embed=&quot;fixTarget[2578]&quot; target=&quot;_top&quot; &gt;GlazedLists - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/State-of-Delete-Giving-Deleted-Object-tp19868272p19868546.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19868272</id>
	<title>State of Delete Giving Deleted Object</title>
	<published>2008-10-07T15:00:15Z</published>
	<updated>2008-10-07T15:00:15Z</updated>
	<author>
		<name>Sam Berlin</name>
	</author>
	<content type="html">Hi All,
&lt;br&gt;&lt;br&gt;I was wondering, is there progress at all on the ListEvent.DELETE
&lt;br&gt;change providing the deleted item? &amp;nbsp;I continue to stumble across this
&lt;br&gt;while building ListEventListeners. &amp;nbsp;The workaround is always to build
&lt;br&gt;a cached copy of the list contents. &amp;nbsp;That workaround seems to be
&lt;br&gt;horribly inefficient in that every place that should just be listening
&lt;br&gt;on the list (and needs to update state based on removed objects) needs
&lt;br&gt;to keep a duplicate copy of the list.
&lt;br&gt;&lt;br&gt;Is there any automagical code that can provide the deleted item
&lt;br&gt;without having each listener keep its own internal state?
&lt;br&gt;&lt;br&gt;Thanks much,
&lt;br&gt;&amp;nbsp;Sam
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19868272&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;
&lt;br&gt;For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19868272&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---User-f2578.html&quot; embed=&quot;fixTarget[2578]&quot; target=&quot;_top&quot; &gt;GlazedLists - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/State-of-Delete-Giving-Deleted-Object-tp19868272p19868272.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19862448</id>
	<title>Re: Issue with SeparatorLists and FilterLists</title>
	<published>2008-10-07T09:47:45Z</published>
	<updated>2008-10-07T09:47:45Z</updated>
	<author>
		<name>James Lemieux</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;Neil,&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; Yes I tried your test case and it reproduces the problem. I haven&amp;#39;t had enough time to dig deeper, but I believe it is a symptom of a longstanding deeper problem. Some lists that deal with groups (GroupingList, UniqueList, SeparatorList) have trouble processing a ListEvent with multiple updates in it. The last person that stumbled onto this bug and mentioned it on the forums did so about a year ago I think. At this point coding around the problem is your best option because our analysis a year ago indicated the problem was design oriented and would require substantial changes to the EventLists mentioned above.&lt;br&gt;
&lt;br&gt;James&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Tue, Oct 7, 2008 at 7:59 AM, neil hart &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19862448&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;neilahart@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;div dir=&quot;ltr&quot;&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;div&gt;&lt;div&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;

&lt;div dir=&quot;ltr&quot;&gt;We are going to need to code around this problem. &amp;nbsp;It will be an&amp;nbsp;inefficient&amp;nbsp;solution but this is causing our lists to stop working with exceptions.&amp;nbsp;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;
&lt;div&gt;
&lt;br&gt;&lt;/div&gt;&lt;div&gt;We can probably build some more examples it that helps.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thanks&lt;/div&gt;&lt;div&gt;Neil&amp;nbsp;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---User-f2578.html&quot; embed=&quot;fixTarget[2578]&quot; target=&quot;_top&quot; &gt;GlazedLists - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Issue-with-SeparatorLists-and-FilterLists-tp19556178p19862448.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19860126</id>
	<title>Re: Issue with SeparatorLists and FilterLists</title>
	<published>2008-10-07T07:59:34Z</published>
	<updated>2008-10-07T07:59:34Z</updated>
	<author>
		<name>neil hart-3</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;&quot;&gt;&lt;div dir=&quot;ltr&quot;&gt;&lt;div&gt;&lt;div class=&quot;Wj3C7c&quot;&gt;&lt;div class=&quot;gmail_quote&quot;&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex&quot;&gt;
&lt;div dir=&quot;ltr&quot;&gt;We are going to need to code around this problem. &amp;nbsp;It will be an&amp;nbsp;inefficient&amp;nbsp;solution but this is causing our lists to stop working with exceptions.&amp;nbsp;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;
&lt;br&gt;&lt;/div&gt;&lt;div&gt;We can probably build some more examples it that helps.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Thanks&lt;/div&gt;&lt;div&gt;Neil&amp;nbsp;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---User-f2578.html&quot; embed=&quot;fixTarget[2578]&quot; target=&quot;_top&quot; &gt;GlazedLists - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Issue-with-SeparatorLists-and-FilterLists-tp19556178p19860126.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19833672</id>
	<title>Re: More flexibility in the OSGi manifest headers</title>
	<published>2008-10-06T01:15:53Z</published>
	<updated>2008-10-06T01:15:53Z</updated>
	<author>
		<name>James Lemieux</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;Barend,&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; I have added your changes to source control and updated the latest jars &lt;a href=&quot;https://glazedlists.dev.java.net/servlets/ProjectDocumentList?folderID=3916&amp;amp;expandFolder=3916&amp;amp;folderID=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;br&gt;Please try it out and let me know if you experience any troubles.&lt;br&gt;&lt;br&gt;James&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Sun, Sep 28, 2008 at 1:15 PM, W.B. Garvelink &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19833672&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;barend.garvelink@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;Hi Jesse,&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
I have attached a bnd definitions file and an modified ant task to&lt;br&gt;
issue #454 in the tracker. The version I uploaded doesn&amp;#39;t delete the&lt;br&gt;
original JAR file but puts the OSGi file alongside it for easy&lt;br&gt;
comparison. After checking the two, you may want to introduce a delete&lt;br&gt;
and rename like there were there before.&lt;br&gt;
&lt;br&gt;
I had to duplicate the JAR metadata in the .bnd file. You may want to&lt;br&gt;
remove it from the ant build, but I&amp;#39;ll leave that up to you.&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Regards,&lt;br&gt;
Barend&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
On Sun, Sep 21, 2008 at 4:52 PM, W.B. Garvelink&lt;br&gt;
&lt;div class=&quot;Ih2E3d&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19833672&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;barend.garvelink@...&lt;/a&gt;&amp;gt; wrote:&lt;br&gt;
&lt;/div&gt;&lt;div class=&quot;Ih2E3d&quot;&gt;&amp;gt; I mentioned last week that I should have an updated bnd definition by&lt;br&gt;
&amp;gt; about now. Altough I have made some progress, I&amp;#39;m not yet satisfied&lt;br&gt;
&amp;gt; with the results and I&amp;#39;m going to take some more time. I&amp;#39;ll check back&lt;br&gt;
&amp;gt; in next weekend.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;Wj3C7c&quot;&gt;---------------------------------------------------------------------&lt;br&gt;
To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19833672&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dev-unsubscribe@...&lt;/a&gt;&lt;br&gt;
For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19833672&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;dev-help@...&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---Dev-f2577.html&quot; embed=&quot;fixTarget[2577]&quot; target=&quot;_top&quot; &gt;GlazedLists - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/More-flexibility-in-the-OSGi-manifest-headers-tp19421768p19833672.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19800819</id>
	<title>Re: Issue with SeparatorLists and FilterLists</title>
	<published>2008-10-03T09:00:14Z</published>
	<updated>2008-10-03T09:00:14Z</updated>
	<author>
		<name>Andrew Gotte</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;Hey,&lt;br&gt;&lt;br&gt;I was wondering if anyone out there was at least able to reproduce this error. See below for steps on how to reproduce and the error that I am seeing. I have attached the code to this email.&lt;br&gt;&lt;br&gt;
Thanks,&lt;br&gt;Andrew&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Sep 18, 2008 at 11:41 AM, Andrew Gotte &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19800819&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;andrew.gotte@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;div dir=&quot;ltr&quot;&gt;&lt;br&gt;I am having issues with SeparatorLists wrapped around FilterLists. I wrote a simplified test case and attached it to this email. &lt;br&gt;&lt;br&gt;To reproduce the issue:&lt;br&gt;&lt;br&gt;1) Run the attached app&lt;br&gt;2) Set &amp;quot;Column 0 filter&amp;quot; to &amp;quot;Mali&amp;quot;&lt;br&gt;

3) Set &amp;quot;Column 1 filter&amp;quot; to &amp;quot;Neil&amp;quot;&lt;br&gt;4) Set &amp;quot;Column 2 filter&amp;quot; to &amp;quot;Andrew&amp;quot;&lt;br&gt;5) Set &amp;quot;Column 3 filter&amp;quot; to &amp;quot;Ross&amp;quot;&lt;br&gt;6) Set &amp;quot;Group By&amp;quot; to &amp;quot;Column 4&amp;quot;&lt;br&gt;

7) Set &amp;quot;Column 0 filter&amp;quot; to &amp;quot;All&amp;quot;&lt;br&gt;&lt;br&gt;and I get the exception below:&lt;br&gt;&lt;br&gt;Exception in thread &amp;quot;AWT-EventQueue-0&amp;quot; java.lang.NullPointerException&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.impl.adt.barcode2.FourColorTree.convertIndexColor(FourColorTree.java:677)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.impl.event.Tree4Deltas.targetUpdate(Tree4Deltas.java:85)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.event.ListEventAssembler$Tree4DeltasAssembler.addChange(ListEventAssembler.java:612)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.event.ListEventAssembler.addChange(ListEventAssembler.java:158)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.event.ListEventAssembler.addChange(ListEventAssembler.java:168)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.event.ListEventAssembler.addUpdate(ListEventAssembler.java:195)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.SeparatorList$SeparatorInjectorList$GrouperClient.groupChanged(SeparatorList.java:542)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.impl.Grouper.listChanged(Grouper.java:163)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.SeparatorList$SeparatorInjectorList.listChanged(SeparatorList.java:513)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.event.ListEventAssembler$ListSequencePublisherAdapter$ListEventFormat.fire(ListEventAssembler.java:840)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.event.SequenceDependenciesEventPublisher$SubjectAndListener.firePendingEvent(SequenceDependenciesEventPublisher.java:388)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.event.SequenceDependenciesEventPublisher.fireEvent(SequenceDependenciesEventPublisher.java:286)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.event.ListEventAssembler$ListSequencePublisherAdapter.fireEvent(ListEventAssembler.java:821)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.event.ListEventAssembler$AssemblerHelper.commitEvent(ListEventAssembler.java:435)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.event.ListEventAssembler.commitEvent(ListEventAssembler.java:259)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.FilterList.changed(FilterList.java:345)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.FilterList.changeMatcher(FilterList.java:242)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.FilterList.changeMatcherWithLocks(FilterList.java:215)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at ca.odell.glazedlists.FilterList.setMatcher(FilterList.java:117)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at com.creditex.glazedlists.separatorlistbug.SeparatorListBug$2.actionPerformed(SeparatorListBug.java:143)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1197)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at javax.swing.JComboBox.setSelectedItem(JComboBox.java:561)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:597)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at javax.swing.plaf.basic.BasicComboPopup$Handler.mouseReleased(BasicComboPopup.java:808)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:232)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.Component.processMouseEvent(Component.java:5517)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at javax.swing.JComponent.processMouseEvent(JComponent.java:3135)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at javax.swing.plaf.basic.BasicComboPopup$1.processMouseEvent(BasicComboPopup.java:476)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.Component.processEvent(Component.java:5282)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.Container.processEvent(Container.java:1966)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.Component.dispatchEventImpl(Component.java:3984)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.Container.dispatchEventImpl(Container.java:2024)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.Component.dispatchEvent(Component.java:3819)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.Container.dispatchEventImpl(Container.java:2010)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.Window.dispatchEventImpl(Window.java:1791)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.Component.dispatchEvent(Component.java:3819)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)&lt;br&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)&lt;br&gt;&lt;br&gt;&lt;br&gt;Thanks in advance for your help,&lt;br&gt;Andrew&lt;br&gt;&lt;br&gt;&lt;/div&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;br /&gt; &lt;br /&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19800819&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;
&lt;br&gt;For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19800819&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;&lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://www.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;SeparatorListBug.java&lt;/strong&gt; (8K) &lt;a href=&quot;http://www.nabble.com/attachment/19800819/0/SeparatorListBug.java&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---User-f2578.html&quot; embed=&quot;fixTarget[2578]&quot; target=&quot;_top&quot; &gt;GlazedLists - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Issue-with-SeparatorLists-and-FilterLists-tp19556178p19800819.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19779854</id>
	<title>re[4]: Using maps to suppliment data in a list</title>
	<published>2008-10-02T06:59:50Z</published>
	<updated>2008-10-02T06:59:50Z</updated>
	<author>
		<name>Kevin Day</name>
	</author>
	<content type="html">Haven't profiled yet (it's been on the 'todo' list for 2 weeks now). &amp;nbsp;For a list with 500 elements in it, a single change that effects all Observables in the lit took well over 500 ms to refresh - it was very noticible in the UI.
&lt;br&gt;&lt;br&gt;I'm not so much worried about the identity loop itself, rather the fact that if a given change causes lots of the oversvables to change, then OEL implementation results in individual change operations being sent into the pipeline. &amp;nbsp;So the performance of downstream handlers is almost certainly the actual bottleneck, but the root cause is that those handlers are receiving individual events - instead of sorting the changed list once, for example, the sort is having to be performed O(n) times.
&lt;br&gt;&lt;br&gt;There isn't much that can be done about this with the Observable pattern as it is - I think this is more of a reflection that Observable isn't performant in list situations where you have a lot of changes going on (which I'm sure is why GL uses a different event publishing mechanism!). &amp;nbsp;In our situation, the Function state is backed by an EventList, so we are able to get a group of changes. &amp;nbsp;Sending those all as a single event would, I believe, have huge performance advantages over the simple OEL.
&lt;br&gt;&lt;br&gt;If I were going to try to come up with a simple solution, I would consider an enhanced form of OEL that has a elementsChanged(List&amp;lt;E&amp;gt; changes) method:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; public void elementsChanged(List&amp;lt;E&amp;gt; listElements) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;this.updates.beginEvent();
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // locate all indexes containing the given listElements
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0, n = size(); i &amp;lt; n; i++) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (E listElement : listElements) { // &amp;lt;-- extra loop
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (listElement == get(i))
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.updates.elementUpdated(i, listElement);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.updates.commitEvent();
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&lt;br&gt;Having that in OEL is a bit messy (we are really dealing with changes in state of the Function, not the downstream elements - the OEL approach feels like we are trying to push things in the wrong place in the pipeline), but it gives the idea.
&lt;br&gt;&lt;br&gt;&lt;br&gt;The way I'm thinking about this is that there are several different classifications of Function objects. &amp;nbsp;We have stateless, globally stateful and element stateful. &amp;nbsp;When a non-stateless function changes state, notification need to be sent to the FunctionList that a refresh is needed. &amp;nbsp;This assumes that the Function implementation is even capable of treating multiple state changes in an atomic way (which we can do by using an EventList to back our map).
&lt;br&gt;&lt;br&gt;I realize that this may be getting pretty specialized... &amp;nbsp;But I'm hoping that I'm keeping the behavior abstracted enough for general use.
&lt;br&gt;&lt;br&gt;Here's one idea on an implementation:
&lt;br&gt;&lt;br&gt;Introduce a StatefulFunction interface that allows the Function to observe changes in Function state. &amp;nbsp;AdvancedFunction almost has this capability (we could check identity of the before and after value. &amp;nbsp;If they are different then we know for sure that the function state changed for that element. &amp;nbsp;However, there is no guarantee that identity = no change - the state of the element itself could have changed.
&lt;br&gt;&lt;br&gt;Instead, I think we punt the requirement for determining whether a given element has changed up to the StatefulFunction itself.
&lt;br&gt;&lt;br&gt;So, we have (in rough pseudo-code):
&lt;br&gt;&lt;br&gt;class StatefulFunctionImpl{
&lt;br&gt;&amp;nbsp; public void registerFunctionChangeListener(FunctionChangeListener l){blah}
&lt;br&gt;&lt;br&gt;&amp;nbsp; private void fireChangeNotificaiton(final List stateChanges){
&lt;br&gt;&amp;nbsp; &amp;nbsp; for(FunctionChangeListener listener: listeners){
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; listener.functionStateChanged(Function f, new ChangeDeterminer(){
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public boolean isElementChanged(E element){
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return stateChangeCausedElementChanged(stateChanges, element);
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; });
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;The stateChangeCausedElementChanged() method is a private utility method specific to the Function (only a given Function implementation can tell for sure if it's internal state change caused a given element to change).
&lt;br&gt;&lt;br&gt;The FunctionList would receive functionStateChanged, then loop it's elements using the ChangeDeterminer as a callback to determine which indexes should be added to the updates list in the FunctionList event firing. &amp;nbsp;Note that this would also be usable by other list implementations that work with Function objects...
&lt;br&gt;&lt;br&gt;&lt;br&gt;Thoughts/comments?
&lt;br&gt;&lt;br&gt;- K
&lt;br&gt;&lt;br&gt;----------------------- Original Message -----------------------
&lt;br&gt;&amp;nbsp;
&lt;br&gt;From: &amp;quot;James Lemieux&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19779854&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jplemieux@...&lt;/a&gt;&amp;gt;
&lt;br&gt;To: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19779854&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users@...&lt;/a&gt;
&lt;br&gt;Cc: 
&lt;br&gt;Date: Wed, 1 Oct 2008 16:42:45 -0700
&lt;br&gt;Subject: Re: re[2]: Using maps to suppliment data in a list
&lt;br&gt;&amp;nbsp;
&lt;br&gt;Any time I've looked at the performance of ObservableElementList.elementChanged, it &amp;nbsp;has always been plenty fast. For EventLists on the order of 10s of 1000s of elements I believe I saw timings between 16 and 32 milliseconds on my machine. How many elements does your ObservableElementList contain, and how many changes are you making simultaneously?
&lt;br&gt;&lt;br&gt;Did you profile the app, to determine the hotspot?
&lt;br&gt;&lt;br&gt;My guess is that the downstream ListEventListeners are probably taking much more of the total time than the tight identity loop in ObservableElementList.elementChanged()... in which case you may do better to use a TransactionList to batch up the changes into a larger update.....
&lt;br&gt;&lt;br&gt;James
&lt;br&gt;&lt;br&gt;&lt;br&gt;On Wed, Oct 1, 2008 at 3:09 PM, Kevin Day &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19779854&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kevin@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;OK - thanks. &amp;nbsp;Option 1 is exactly the solution that we are working with for testing (although we use a simple Connector so we can maintain decoupling).
&lt;br&gt;&lt;br&gt;If we run into performance issues, I'll have to give some thought to option 2. &amp;nbsp;The ObservableElementList may not be efficient if we are dealing with multiple simultaneous changes to the CompliationResults map. &amp;nbsp;The compilation could be providing multiple updates to the EventList that backs the CompliationResultManager. &amp;nbsp;Having ObservableElementList loop the entire list over and over again is not particularly efficient.
&lt;br&gt;&lt;br&gt;We actually ran into this when we had each of our elements in one list bound to a value holder. &amp;nbsp;We'd change the value in the value holder, all of the elements in the list would fire their own property change events, and the ObservableElementList would grind things to a halt as it performed the O(n) individual event notifications on the pipeline.
&lt;br&gt;&lt;br&gt;This performance issue is what brought up my original question. &amp;nbsp;I'll give it some thought - maybe there's a way to abstract this desired behavior somehow. &amp;nbsp;I'm sure that providing data from an event aware map to a composite object should be a factorable concern...
&lt;br&gt;&lt;br&gt;- K
&lt;br&gt;&lt;br&gt;&lt;br&gt;----------------------- Original Message -----------------------
&lt;br&gt;&lt;br&gt;From: &amp;quot;James Lemieux&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19779854&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jplemieux@...&lt;/a&gt;&amp;gt;
&lt;br&gt;To: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19779854&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users@...&lt;/a&gt;
&lt;br&gt;Cc:
&lt;br&gt;Date: Wed, 1 Oct 2008 14:20:08 -0700
&lt;br&gt;Subject: Re: Using maps to suppliment data in a list
&lt;br&gt;&lt;br&gt;If you absolutely need to store this &amp;quot;supplemental data&amp;quot; in a Map, and the Map can change, then there are just 2 solutions I can concieve of:
&lt;br&gt;&lt;br&gt;1) If you can get a handle to an appropriate ObservableElementList in your pipeline, you could actually call elementChanged() manually (from within your CompilationResultsManager) and let it do all of this work for you....
&lt;br&gt;&lt;br&gt;2) Otherwise you can mimic some of the function of ObservableElementList yourself. i.e.:
&lt;br&gt;&lt;br&gt;The map within the &amp;quot;CompliationResultsManager&amp;quot; is updated, and immediately after the update the SourceFile(s) that were effected are then found (by identity, so it can be done quickly) in the appropriate EventList and set overtop of themselves.
&lt;br&gt;&lt;br&gt;e.g.:
&lt;br&gt;&lt;br&gt;SourceFile changed = ....
&lt;br&gt;&lt;br&gt;eventList.getReadWriteLock().writeLock().lock();
&lt;br&gt;try {
&lt;br&gt;&amp;nbsp; &amp;nbsp;// locate all indexes containing the given listElement
&lt;br&gt;&amp;nbsp; &amp;nbsp;for (int i = 0, n = size(); i &amp;lt; n; i++) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if (changed == eventList.get(i))
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;eventList.set(i, changed);
&lt;br&gt;&lt;br&gt;} finally {
&lt;br&gt;eventList.getReadWriteLock().writeLock().unlock();
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;This code is very similar to ObservableElementList.elementChanged(...);
&lt;br&gt;&lt;br&gt;This code has no effect on the contents of the EventList, but DOES raise a ListEvent describing an update at index i so that downstream EventLists can react accordiingly. In fact, before ObservableElementList was written, this was the only way to force updates through a pipeline....
&lt;br&gt;&lt;br&gt;James
&lt;br&gt;&lt;br&gt;&lt;br&gt;On Mon, Sep 29, 2008 at 3:18 PM, Kevin Day &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19779854&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kevin@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;This may be one of those insane questions that just shouldn't be asked - but you never know... &amp;nbsp;I'm also open to the idea that I may be asking the wrong question, and that there is a better way to attack the problem I describe below. &amp;nbsp;Here's the question:
&lt;br&gt;&lt;br&gt;If we are using one EventList to inject information into the elements of another EventList (i.e. compositing objects together) via FunctionList, is there an effective way to manage updates in the pipeline, or do we have to step outside of the pipeline event notification mechanism and use ObservableElementList?
&lt;br&gt;&lt;br&gt;&lt;br&gt;Here are the details behind the question:
&lt;br&gt;&lt;br&gt;We have an EventList of business objects. &amp;nbsp;As part of our processing, we wind up with supplimental data associated with the business objects that we want to be able to display in a grid, or possibly even perform additional filtering/sorting/etc... with.
&lt;br&gt;&lt;br&gt;To make this concrete, imagine a compiler that has a list of files (SourceFile objects). &amp;nbsp;The results of the compilation are stored in CompilationResults instances.
&lt;br&gt;&lt;br&gt;There are a number of ways to deal with this architecturaly - but right now the most desirable one is to have an external CompliationResultsManager that maintains a map between SourceFile objects (or really ANY sort of object that might be compilable) and the corresponding CompilationResults. &amp;nbsp;Then we use a FunctionList to build a list of composite SourceFile/CompliationResults objects when and where we need them (i.e. for display in a grid). &amp;nbsp;We would use a private SourceFileAndResults class or something along those lines to hold the composite.
&lt;br&gt;&lt;br&gt;GlazedLists makes this a piece of cake - with one little problem: &amp;nbsp;It is possible (in fact likely) that the map backing the Function could change (e.g. we call myCompilationResultsMap.put(someSourceFile, newCompilationResults) ) - and we need to have some mechanism for sending change notifications for the effected list members.
&lt;br&gt;&lt;br&gt;If the Function was changing in a global sense (i.e. all of the composite objects in the list need to be updated), we could force the issue by just re-setting the same forwardFunction. &amp;nbsp;But our situation is more surgical than that.
&lt;br&gt;&lt;br&gt;A single change to the map really only requires a few elements in the list to update. &amp;nbsp;To make things more interesting, we are thinking about using an EventList along with syncEventListToMap() to manage the SourceFile-&amp;gt;CompilationResults map. &amp;nbsp;Ideally, changes to the map's event list would be reflected automatically in the main list pipeline.
&lt;br&gt;&lt;br&gt;&lt;br&gt;And here's a potential solution, but one that makes me a bit uncomfortable... :
&lt;br&gt;&lt;br&gt;One option that we are considering is to place an ObservableElementList right before the FunctionList in the pipeline, then use a custom Connector object that fires changes in response to changes in the map (the keys to the map are the elements of the OversavableElementList). &amp;nbsp;It would be nice to be able to have the Connector issue batches of changes in an efficient way (rather than submitting them one at a time)... &amp;nbsp;If performance is an issue, I suppose that we could subclass ObesrvableElementList to come up with an elementChanged() method that accepts a list of changed elements.
&lt;br&gt;&lt;br&gt;That said, I'm concerned that the use of Observable here is stepping outside of the purpose of the event publisher. &amp;nbsp;Is there any way to take advantage of the fact that we are using EventLists for both the map and the pipeline? &amp;nbsp;Or am I worrying about the wrong thing? &amp;nbsp;Do I need to create a relatedListener relationship between the two lists?
&lt;br&gt;&lt;br&gt;Is there a better way to deal with this kind of situation, or is there some other strategy that we might be missing?
&lt;br&gt;&lt;br&gt;Thanks much,
&lt;br&gt;&lt;br&gt;- K
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19779854&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;
&lt;br&gt;For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19779854&amp;i=7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19779854&amp;i=8&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;
&lt;br&gt;For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19779854&amp;i=9&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19779854&amp;i=10&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;
&lt;br&gt;For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19779854&amp;i=11&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---User-f2578.html&quot; embed=&quot;fixTarget[2578]&quot; target=&quot;_top&quot; &gt;GlazedLists - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Using-maps-to-suppliment-data-in-a-list-tp19732804p19779854.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19771172</id>
	<title>Re: re[2]: Using maps to suppliment data in a list</title>
	<published>2008-10-01T16:42:45Z</published>
	<updated>2008-10-01T16:42:45Z</updated>
	<author>
		<name>James Lemieux</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;Any time I&amp;#39;ve looked at the performance of ObservableElementList.elementChanged, it&amp;nbsp; has always been plenty fast. For EventLists on the order of 10s of 1000s of elements I believe I saw timings between 16 and 32 milliseconds on my machine. How many elements does your ObservableElementList contain, and how many changes are you making simultaneously?&lt;br&gt;
&lt;br&gt;Did you profile the app, to determine the hotspot?&lt;br&gt;&lt;br&gt;My guess is that the downstream ListEventListeners are probably taking much more of the total time than the tight identity loop in ObservableElementList.elementChanged()... in which case you may do better to use a TransactionList to batch up the changes into a larger update.....&lt;br&gt;
&lt;br&gt;James&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Wed, Oct 1, 2008 at 3:09 PM, Kevin Day &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19771172&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kevin@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
OK - thanks. &amp;nbsp;Option 1 is exactly the solution that we are working with for testing (although we use a simple Connector so we can maintain decoupling).&lt;br&gt;
&lt;br&gt;
If we run into performance issues, I&amp;#39;ll have to give some thought to option 2. &amp;nbsp;The ObservableElementList may not be efficient if we are dealing with multiple simultaneous changes to the CompliationResults map. &amp;nbsp;The compilation could be providing multiple updates to the EventList that backs the CompliationResultManager. &amp;nbsp;Having ObservableElementList loop the entire list over and over again is not particularly efficient.&lt;br&gt;

&lt;br&gt;
We actually ran into this when we had each of our elements in one list bound to a value holder. &amp;nbsp;We&amp;#39;d change the value in the value holder, all of the elements in the list would fire their own property change events, and the ObservableElementList would grind things to a halt as it performed the O(n) individual event notifications on the pipeline.&lt;br&gt;

&lt;br&gt;
This performance issue is what brought up my original question. &amp;nbsp;I&amp;#39;ll give it some thought - maybe there&amp;#39;s a way to abstract this desired behavior somehow. &amp;nbsp;I&amp;#39;m sure that providing data from an event aware map to a composite object should be a factorable concern...&lt;br&gt;

&lt;font color=&quot;#888888&quot;&gt;&lt;br&gt;
- K&lt;br&gt;
&lt;/font&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;Wj3C7c&quot;&gt;&lt;br&gt;
----------------------- Original Message -----------------------&lt;br&gt;
&lt;br&gt;
From: &amp;quot;James Lemieux&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19771172&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jplemieux@...&lt;/a&gt;&amp;gt;&lt;br&gt;
To: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19771172&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users@...&lt;/a&gt;&lt;br&gt;
Cc:&lt;br&gt;
Date: Wed, 1 Oct 2008 14:20:08 -0700&lt;br&gt;
Subject: Re: Using maps to suppliment data in a list&lt;br&gt;
&lt;br&gt;
If you absolutely need to store this &amp;quot;supplemental data&amp;quot; in a Map, and the Map can change, then there are just 2 solutions I can concieve of:&lt;br&gt;
&lt;br&gt;
1) If you can get a handle to an appropriate ObservableElementList in your pipeline, you could actually call elementChanged() manually (from within your CompilationResultsManager) and let it do all of this work for you....&lt;br&gt;

&lt;br&gt;
2) Otherwise you can mimic some of the function of ObservableElementList yourself. i.e.:&lt;br&gt;
&lt;br&gt;
The map within the &amp;quot;CompliationResultsManager&amp;quot; is updated, and immediately after the update the SourceFile(s) that were effected are then found (by identity, so it can be done quickly) in the appropriate EventList and set overtop of themselves.&lt;br&gt;

&lt;br&gt;
e.g.:&lt;br&gt;
&lt;br&gt;
SourceFile changed = ....&lt;br&gt;
&lt;br&gt;
eventList.getReadWriteLock().writeLock().lock();&lt;br&gt;
try {&lt;br&gt;
 &amp;nbsp; &amp;nbsp; // locate all indexes containing the given listElement&lt;br&gt;
 &amp;nbsp; &amp;nbsp; for (int i = 0, n = size(); i &amp;lt; n; i++) {&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (changed == eventList.get(i))&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; eventList.set(i, changed);&lt;br&gt;
&lt;br&gt;
} finally {&lt;br&gt;
 &amp;nbsp;eventList.getReadWriteLock().writeLock().unlock();&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
This code is very similar to ObservableElementList.elementChanged(...);&lt;br&gt;
&lt;br&gt;
This code has no effect on the contents of the EventList, but DOES raise a ListEvent describing an update at index i so that downstream EventLists can react accordiingly. In fact, before ObservableElementList was written, this was the only way to force updates through a pipeline....&lt;br&gt;

&lt;br&gt;
James&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
On Mon, Sep 29, 2008 at 3:18 PM, Kevin Day &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19771172&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kevin@...&lt;/a&gt;&amp;gt; wrote:&lt;br&gt;
&lt;br&gt;
This may be one of those insane questions that just shouldn&amp;#39;t be asked - but you never know... &amp;nbsp;I&amp;#39;m also open to the idea that I may be asking the wrong question, and that there is a better way to attack the problem I describe below. &amp;nbsp;Here&amp;#39;s the question:&lt;br&gt;

&lt;br&gt;
If we are using one EventList to inject information into the elements of another EventList (i.e. compositing objects together) via FunctionList, is there an effective way to manage updates in the pipeline, or do we have to step outside of the pipeline event notification mechanism and use ObservableElementList?&lt;br&gt;

&lt;br&gt;
&lt;br&gt;
Here are the details behind the question:&lt;br&gt;
&lt;br&gt;
We have an EventList of business objects. &amp;nbsp;As part of our processing, we wind up with supplimental data associated with the business objects that we want to be able to display in a grid, or possibly even perform additional filtering/sorting/etc... with.&lt;br&gt;

&lt;br&gt;
To make this concrete, imagine a compiler that has a list of files (SourceFile objects). &amp;nbsp;The results of the compilation are stored in CompilationResults instances.&lt;br&gt;
&lt;br&gt;
There are a number of ways to deal with this architecturaly - but right now the most desirable one is to have an external CompliationResultsManager that maintains a map between SourceFile objects (or really ANY sort of object that might be compilable) and the corresponding CompilationResults. &amp;nbsp;Then we use a FunctionList to build a list of composite SourceFile/CompliationResults objects when and where we need them (i.e. for display in a grid). &amp;nbsp;We would use a private SourceFileAndResults class or something along those lines to hold the composite.&lt;br&gt;

&lt;br&gt;
GlazedLists makes this a piece of cake - with one little problem: &amp;nbsp;It is possible (in fact likely) that the map backing the Function could change (e.g. we call myCompilationResultsMap.put(someSourceFile, newCompilationResults) ) - and we need to have some mechanism for sending change notifications for the effected list members.&lt;br&gt;

&lt;br&gt;
If the Function was changing in a global sense (i.e. all of the composite objects in the list need to be updated), we could force the issue by just re-setting the same forwardFunction. &amp;nbsp;But our situation is more surgical than that.&lt;br&gt;

&lt;br&gt;
A single change to the map really only requires a few elements in the list to update. &amp;nbsp;To make things more interesting, we are thinking about using an EventList along with syncEventListToMap() to manage the SourceFile-&amp;gt;CompilationResults map. &amp;nbsp;Ideally, changes to the map&amp;#39;s event list would be reflected automatically in the main list pipeline.&lt;br&gt;

&lt;br&gt;
&lt;br&gt;
And here&amp;#39;s a potential solution, but one that makes me a bit uncomfortable... :&lt;br&gt;
&lt;br&gt;
One option that we are considering is to place an ObservableElementList right before the FunctionList in the pipeline, then use a custom Connector object that fires changes in response to changes in the map (the keys to the map are the elements of the OversavableElementList). &amp;nbsp;It would be nice to be able to have the Connector issue batches of changes in an efficient way (rather than submitting them one at a time)... &amp;nbsp;If performance is an issue, I suppose that we could subclass ObesrvableElementList to come up with an elementChanged() method that accepts a list of changed elements.&lt;br&gt;

&lt;br&gt;
That said, I&amp;#39;m concerned that the use of Observable here is stepping outside of the purpose of the event publisher. &amp;nbsp;Is there any way to take advantage of the fact that we are using EventLists for both the map and the pipeline? &amp;nbsp;Or am I worrying about the wrong thing? &amp;nbsp;Do I need to create a relatedListener relationship between the two lists?&lt;br&gt;

&lt;br&gt;
Is there a better way to deal with this kind of situation, or is there some other strategy that we might be missing?&lt;br&gt;
&lt;br&gt;
Thanks much,&lt;br&gt;
&lt;br&gt;
- K&lt;br&gt;
&lt;br&gt;
---------------------------------------------------------------------&lt;br&gt;
To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19771172&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;&lt;br&gt;
For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19771172&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
---------------------------------------------------------------------&lt;br&gt;
To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19771172&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;&lt;br&gt;
For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19771172&amp;i=7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---User-f2578.html&quot; embed=&quot;fixTarget[2578]&quot; target=&quot;_top&quot; &gt;GlazedLists - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Using-maps-to-suppliment-data-in-a-list-tp19732804p19771172.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19770156</id>
	<title>re[2]: Using maps to suppliment data in a list</title>
	<published>2008-10-01T15:09:34Z</published>
	<updated>2008-10-01T15:09:34Z</updated>
	<author>
		<name>Kevin Day</name>
	</author>
	<content type="html">OK - thanks. &amp;nbsp;Option 1 is exactly the solution that we are working with for testing (although we use a simple Connector so we can maintain decoupling).
&lt;br&gt;&lt;br&gt;If we run into performance issues, I'll have to give some thought to option 2. &amp;nbsp;The ObservableElementList may not be efficient if we are dealing with multiple simultaneous changes to the CompliationResults map. &amp;nbsp;The compilation could be providing multiple updates to the EventList that backs the CompliationResultManager. &amp;nbsp;Having ObservableElementList loop the entire list over and over again is not particularly efficient.
&lt;br&gt;&lt;br&gt;We actually ran into this when we had each of our elements in one list bound to a value holder. &amp;nbsp;We'd change the value in the value holder, all of the elements in the list would fire their own property change events, and the ObservableElementList would grind things to a halt as it performed the O(n) individual event notifications on the pipeline.
&lt;br&gt;&lt;br&gt;This performance issue is what brought up my original question. &amp;nbsp;I'll give it some thought - maybe there's a way to abstract this desired behavior somehow. &amp;nbsp;I'm sure that providing data from an event aware map to a composite object should be a factorable concern...
&lt;br&gt;&lt;br&gt;- K
&lt;br&gt;&lt;br&gt;----------------------- Original Message -----------------------
&lt;br&gt;&amp;nbsp;
&lt;br&gt;From: &amp;quot;James Lemieux&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19770156&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jplemieux@...&lt;/a&gt;&amp;gt;
&lt;br&gt;To: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19770156&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users@...&lt;/a&gt;
&lt;br&gt;Cc: 
&lt;br&gt;Date: Wed, 1 Oct 2008 14:20:08 -0700
&lt;br&gt;Subject: Re: Using maps to suppliment data in a list
&lt;br&gt;&amp;nbsp;
&lt;br&gt;If you absolutely need to store this &amp;quot;supplemental data&amp;quot; in a Map, and the Map can change, then there are just 2 solutions I can concieve of:
&lt;br&gt;&lt;br&gt;1) If you can get a handle to an appropriate ObservableElementList in your pipeline, you could actually call elementChanged() manually (from within your CompilationResultsManager) and let it do all of this work for you....
&lt;br&gt;&lt;br&gt;2) Otherwise you can mimic some of the function of ObservableElementList yourself. i.e.:
&lt;br&gt;&lt;br&gt;The map within the &amp;quot;CompliationResultsManager&amp;quot; is updated, and immediately after the update the SourceFile(s) that were effected are then found (by identity, so it can be done quickly) in the appropriate EventList and set overtop of themselves.
&lt;br&gt;&lt;br&gt;e.g.:
&lt;br&gt;&lt;br&gt;SourceFile changed = ....
&lt;br&gt;&lt;br&gt;eventList.getReadWriteLock().writeLock().lock();
&lt;br&gt;try {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;// locate all indexes containing the given listElement
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;for (int i = 0, n = size(); i &amp;lt; n; i++) {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (changed == eventList.get(i))
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;eventList.set(i, changed);
&lt;br&gt;&lt;br&gt;} finally {
&lt;br&gt;&amp;nbsp; eventList.getReadWriteLock().writeLock().unlock();
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;This code is very similar to ObservableElementList.elementChanged(...);
&lt;br&gt;&lt;br&gt;This code has no effect on the contents of the EventList, but DOES raise a ListEvent describing an update at index i so that downstream EventLists can react accordiingly. In fact, before ObservableElementList was written, this was the only way to force updates through a pipeline....
&lt;br&gt;&lt;br&gt;James
&lt;br&gt;&lt;br&gt;&lt;br&gt;On Mon, Sep 29, 2008 at 3:18 PM, Kevin Day &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19770156&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kevin@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;This may be one of those insane questions that just shouldn't be asked - but you never know... &amp;nbsp;I'm also open to the idea that I may be asking the wrong question, and that there is a better way to attack the problem I describe below. &amp;nbsp;Here's the question:
&lt;br&gt;&lt;br&gt;If we are using one EventList to inject information into the elements of another EventList (i.e. compositing objects together) via FunctionList, is there an effective way to manage updates in the pipeline, or do we have to step outside of the pipeline event notification mechanism and use ObservableElementList?
&lt;br&gt;&lt;br&gt;&lt;br&gt;Here are the details behind the question:
&lt;br&gt;&lt;br&gt;We have an EventList of business objects. &amp;nbsp;As part of our processing, we wind up with supplimental data associated with the business objects that we want to be able to display in a grid, or possibly even perform additional filtering/sorting/etc... with.
&lt;br&gt;&lt;br&gt;To make this concrete, imagine a compiler that has a list of files (SourceFile objects). &amp;nbsp;The results of the compilation are stored in CompilationResults instances.
&lt;br&gt;&lt;br&gt;There are a number of ways to deal with this architecturaly - but right now the most desirable one is to have an external CompliationResultsManager that maintains a map between SourceFile objects (or really ANY sort of object that might be compilable) and the corresponding CompilationResults. &amp;nbsp;Then we use a FunctionList to build a list of composite SourceFile/CompliationResults objects when and where we need them (i.e. for display in a grid). &amp;nbsp;We would use a private SourceFileAndResults class or something along those lines to hold the composite.
&lt;br&gt;&lt;br&gt;GlazedLists makes this a piece of cake - with one little problem: &amp;nbsp;It is possible (in fact likely) that the map backing the Function could change (e.g. we call myCompilationResultsMap.put(someSourceFile, newCompilationResults) ) - and we need to have some mechanism for sending change notifications for the effected list members.
&lt;br&gt;&lt;br&gt;If the Function was changing in a global sense (i.e. all of the composite objects in the list need to be updated), we could force the issue by just re-setting the same forwardFunction. &amp;nbsp;But our situation is more surgical than that.
&lt;br&gt;&lt;br&gt;A single change to the map really only requires a few elements in the list to update. &amp;nbsp;To make things more interesting, we are thinking about using an EventList along with syncEventListToMap() to manage the SourceFile-&amp;gt;CompilationResults map. &amp;nbsp;Ideally, changes to the map's event list would be reflected automatically in the main list pipeline.
&lt;br&gt;&lt;br&gt;&lt;br&gt;And here's a potential solution, but one that makes me a bit uncomfortable... :
&lt;br&gt;&lt;br&gt;One option that we are considering is to place an ObservableElementList right before the FunctionList in the pipeline, then use a custom Connector object that fires changes in response to changes in the map (the keys to the map are the elements of the OversavableElementList). &amp;nbsp;It would be nice to be able to have the Connector issue batches of changes in an efficient way (rather than submitting them one at a time)... &amp;nbsp;If performance is an issue, I suppose that we could subclass ObesrvableElementList to come up with an elementChanged() method that accepts a list of changed elements.
&lt;br&gt;&lt;br&gt;That said, I'm concerned that the use of Observable here is stepping outside of the purpose of the event publisher. &amp;nbsp;Is there any way to take advantage of the fact that we are using EventLists for both the map and the pipeline? &amp;nbsp;Or am I worrying about the wrong thing? &amp;nbsp;Do I need to create a relatedListener relationship between the two lists?
&lt;br&gt;&lt;br&gt;Is there a better way to deal with this kind of situation, or is there some other strategy that we might be missing?
&lt;br&gt;&lt;br&gt;Thanks much,
&lt;br&gt;&lt;br&gt;- K
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19770156&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;
&lt;br&gt;For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19770156&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19770156&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;
&lt;br&gt;For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19770156&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---User-f2578.html&quot; embed=&quot;fixTarget[2578]&quot; target=&quot;_top&quot; &gt;GlazedLists - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Using-maps-to-suppliment-data-in-a-list-tp19732804p19770156.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19769371</id>
	<title>Re: Using maps to suppliment data in a list</title>
	<published>2008-10-01T14:20:08Z</published>
	<updated>2008-10-01T14:20:08Z</updated>
	<author>
		<name>James Lemieux</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;If you absolutely need to store this &amp;quot;supplemental data&amp;quot; in a Map, and the Map can change, then there are just 2 solutions I can concieve of:&lt;br&gt;&lt;br&gt;1) If you can get a handle to an appropriate
ObservableElementList in your pipeline, you could actually call
elementChanged() manually (from within your CompilationResultsManager)
and let it do all of this work for you....&lt;br&gt;
&lt;br&gt;2) Otherwise you can mimic some of the function of ObservableElementList yourself. i.e.:&lt;br&gt;&lt;br&gt;The map within the &amp;quot;CompliationResultsManager&amp;quot; is updated, and immediately after the update the SourceFile(s) that were effected are then found (by identity, so it can be done quickly) in the appropriate EventList and set overtop of themselves.&lt;br&gt;
&lt;br&gt;e.g.:&lt;br&gt;&lt;br&gt;SourceFile changed = ....&lt;br&gt;&lt;br&gt;eventList.getReadWriteLock().writeLock().lock();&lt;br&gt;try {&lt;br&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; // locate all indexes containing the given listElement&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0, n = size(); i &amp;lt; n; i++) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (changed == eventList.get(i))&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; eventList.set(i, changed);&lt;br&gt;&lt;br&gt;} finally {&lt;br&gt;&amp;nbsp;&amp;nbsp; eventList.getReadWriteLock().writeLock().unlock();&lt;br&gt;}&lt;br&gt;&lt;br&gt;This code is very similar to ObservableElementList.elementChanged(...);&lt;br&gt;
&lt;br&gt;This code has no effect on the contents of the EventList, but DOES raise a ListEvent describing an update at index i so that downstream EventLists can react accordiingly. In fact, before ObservableElementList was written, this was the only way to force updates through a pipeline....&lt;br&gt;
&lt;br&gt;James&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Mon, Sep 29, 2008 at 3:18 PM, Kevin Day &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19769371&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kevin@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
This may be one of those insane questions that just shouldn&amp;#39;t be asked - but you never know... &amp;nbsp;I&amp;#39;m also open to the idea that I may be asking the wrong question, and that there is a better way to attack the problem I describe below. &amp;nbsp;Here&amp;#39;s the question:&lt;br&gt;

&lt;br&gt;
If we are using one EventList to inject information into the elements of another EventList (i.e. compositing objects together) via FunctionList, is there an effective way to manage updates in the pipeline, or do we have to step outside of the pipeline event notification mechanism and use ObservableElementList?&lt;br&gt;

&lt;br&gt;
&lt;br&gt;
Here are the details behind the question:&lt;br&gt;
&lt;br&gt;
We have an EventList of business objects. &amp;nbsp;As part of our processing, we wind up with supplimental data associated with the business objects that we want to be able to display in a grid, or possibly even perform additional filtering/sorting/etc... with.&lt;br&gt;

&lt;br&gt;
To make this concrete, imagine a compiler that has a list of files (SourceFile objects). &amp;nbsp;The results of the compilation are stored in CompilationResults instances.&lt;br&gt;
&lt;br&gt;
There are a number of ways to deal with this architecturaly - but right now the most desirable one is to have an external CompliationResultsManager that maintains a map between SourceFile objects (or really ANY sort of object that might be compilable) and the corresponding CompilationResults. &amp;nbsp;Then we use a FunctionList to build a list of composite SourceFile/CompliationResults objects when and where we need them (i.e. for display in a grid). &amp;nbsp;We would use a private SourceFileAndResults class or something along those lines to hold the composite.&lt;br&gt;

&lt;br&gt;
GlazedLists makes this a piece of cake - with one little problem: &amp;nbsp;It is possible (in fact likely) that the map backing the Function could change (e.g. we call myCompilationResultsMap.put(someSourceFile, newCompilationResults) ) - and we need to have some mechanism for sending change notifications for the effected list members.&lt;br&gt;

&lt;br&gt;
If the Function was changing in a global sense (i.e. all of the composite objects in the list need to be updated), we could force the issue by just re-setting the same forwardFunction. &amp;nbsp;But our situation is more surgical than that.&lt;br&gt;

&lt;br&gt;
A single change to the map really only requires a few elements in the list to update. &amp;nbsp;To make things more interesting, we are thinking about using an EventList along with syncEventListToMap() to manage the SourceFile-&amp;gt;CompilationResults map. &amp;nbsp;Ideally, changes to the map&amp;#39;s event list would be reflected automatically in the main list pipeline.&lt;br&gt;

&lt;br&gt;
&lt;br&gt;
And here&amp;#39;s a potential solution, but one that makes me a bit uncomfortable... :&lt;br&gt;
&lt;br&gt;
One option that we are considering is to place an ObservableElementList right before the FunctionList in the pipeline, then use a custom Connector object that fires changes in response to changes in the map (the keys to the map are the elements of the OversavableElementList). &amp;nbsp;It would be nice to be able to have the Connector issue batches of changes in an efficient way (rather than submitting them one at a time)... &amp;nbsp;If performance is an issue, I suppose that we could subclass ObesrvableElementList to come up with an elementChanged() method that accepts a list of changed elements.&lt;br&gt;

&lt;br&gt;
That said, I&amp;#39;m concerned that the use of Observable here is stepping outside of the purpose of the event publisher. &amp;nbsp;Is there any way to take advantage of the fact that we are using EventLists for both the map and the pipeline? &amp;nbsp;Or am I worrying about the wrong thing? &amp;nbsp;Do I need to create a relatedListener relationship between the two lists?&lt;br&gt;

&lt;br&gt;
Is there a better way to deal with this kind of situation, or is there some other strategy that we might be missing?&lt;br&gt;
&lt;br&gt;
Thanks much,&lt;br&gt;
&lt;br&gt;
- K&lt;br&gt;
&lt;br&gt;
---------------------------------------------------------------------&lt;br&gt;
To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19769371&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;&lt;br&gt;
For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19769371&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---User-f2578.html&quot; embed=&quot;fixTarget[2578]&quot; target=&quot;_top&quot; &gt;GlazedLists - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Using-maps-to-suppliment-data-in-a-list-tp19732804p19769371.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19765827</id>
	<title>Re: re[2]: Debugging Listener Cycles</title>
	<published>2008-10-01T10:53:59Z</published>
	<updated>2008-10-01T10:53:59Z</updated>
	<author>
		<name>James Lemieux</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;A few explanations to some of the open questions / comments in this Thread:&lt;br&gt;&lt;br&gt;1) All EventLists in a pipeline *must* share the same read/write locks.... that assumption is guaranteed to remain stable forever.&lt;br&gt;
&lt;br&gt;2) Sam, demonstrated a nice exception to my previously stated rule: stateless ListEventListeners don&amp;#39;t need to be guarded with locks during creation or addition to the pipeline. Good Point Sam.&lt;br&gt;&lt;br&gt;3) Any STATEFUL ListEventListener (nearly all TransformedLists are good examples of STATEFUL ListEventListeners) needs to prevent modification of the pipeline&amp;#39;s data during its initialization and registration with the pipeline. In other words:&lt;br&gt;
&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp; // 1. initialize my internal state from the source EventList&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; // 2. start listening to changes in the source EventList&lt;br&gt;}&lt;br&gt;&lt;br&gt;needs to be an atomic operation, guarded by AT LEAST the read lock (the write lock would work too, but would be overkill since we only expect read operations on the pipeline during 1.).&lt;br&gt;
&lt;br&gt;4. To make something clear: when a ListEvent is fired through a pipeline, it is effectively operating on a copy of the data structure that contains all ListEventListeners. (In practice, we use copy-on-write semantics to guarantee this, not copy-on-read, since the number of reads of the data structure &amp;gt; number of writes) This removes any ambiguity about which ListEventListeners should receive the ListEvent. Changes to the pipeline during the firing of a ListEvent will not be see the ListEvent. They will see subsequent ListEvents.&lt;br&gt;
&lt;br&gt;5. Sam made a nice suggestion with TransformedListsFactory. It would remove much of the &amp;quot;intellectual weight&amp;quot; to this kind of problem. There&amp;#39;s only one major stroke against such a class. One of the design considerations permeating all of GL is that we give our API users the tools to be &amp;quot;thread-safe&amp;quot; (read / write locks), but we don&amp;#39;t use those tools on their behalf. (In practice there ARE a few places in the bowels of GL where we do acquire locks because users can&amp;#39;t/shouldn&amp;#39;t get to those areas, so we&amp;#39;re not perfect on this philosophy). We call this design &amp;quot;thread-ready&amp;quot; but not &amp;quot;thread-safe&amp;quot;. The reasons for this design are simple:&lt;br&gt;
&lt;br&gt;&amp;nbsp;&amp;nbsp; a) some apps don&amp;#39;t need locking at all, and would be penalized unnecessarily (i.e. all operations on the pipeline are from a single thread)&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp; b) the more a library acquires public locks, the more you increase the potential for deadlock. There is no automatic scheme for resolving these problems... so instead we pass the torch to our API users and say &amp;quot;you probably know much better than we ever could if and when you need to lock things&amp;quot;&lt;br&gt;
&lt;br&gt;So, with 5. in mind, is it correct to lock the pipeline on behalf of the API user during the constructor of a TransformedList? Where are Socrates and Plato when you need them most?&lt;br&gt;&lt;br&gt;James&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;
On Wed, Oct 1, 2008 at 9:05 AM, Sam Berlin &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sberlin@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
It would seem like there should be a TransformedListsFactory that has&lt;br&gt;
create methods for all transformed list subclasses and locks the&lt;br&gt;
source list while creating the sublist, as well as a utility method&lt;br&gt;
that adds listeners under the source list&amp;#39;s lock (assuming that&amp;#39;s&lt;br&gt;
necessary -- I still don&amp;#39;t completely understand why it is).&lt;br&gt;
&lt;font color=&quot;#888888&quot;&gt;&lt;br&gt;
Sam&lt;br&gt;
&lt;/font&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;Wj3C7c&quot;&gt;&lt;br&gt;
On Wed, Oct 1, 2008 at 11:40 AM, Kevin Day &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kevin@...&lt;/a&gt;&amp;gt; wrote:&lt;br&gt;
&amp;gt; The place I&amp;#39;ve run into problems with only grabbing a read lock when adding&lt;br&gt;
&amp;gt; listeners is when you start bridging threads. &amp;nbsp;For example, the list that&lt;br&gt;
&amp;gt; moves events over to the Swing EDT has some extremely funky logic in it to&lt;br&gt;
&amp;gt; ensure that calls are dispatched in an orderly fashion - even if you are&lt;br&gt;
&amp;gt; adding a listener when there are already events in the queue (yes - it&amp;#39;s&lt;br&gt;
&amp;gt; really, really nasty - I don&amp;#39;t understand the code completely, but I spent&lt;br&gt;
&amp;gt; enough time spelunking during a debugging session awhile back that I&lt;br&gt;
&amp;gt; appreciate the complexity and the reason for it). &amp;nbsp;When it does this, it&lt;br&gt;
&amp;gt; dispatches an event onto the EDT and waits for that event to complete. &amp;nbsp;That&lt;br&gt;
&amp;gt; event, in turn, can wind up having to grab a write lock on the list&lt;br&gt;
&amp;gt; pipeline. &amp;nbsp;This creates a potential race condition if you are just grabbing&lt;br&gt;
&amp;gt; read locks when you add listeners.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; When we implemented our PluggableEventList, we found that if we only grabbed&lt;br&gt;
&amp;gt; a read-lock before adding listeners that we dead-locked sometimes b/c of the&lt;br&gt;
&amp;gt; EDT proxying behavior. &amp;nbsp;Grabbing a write lock is defensive in this regard.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I think the way to explain it is that the readwrite lock is protecting a&lt;br&gt;
&amp;gt; *lot* more than just the contents of the list. &amp;nbsp;The lock is *actually*&lt;br&gt;
&amp;gt; protecting the list event publisher state as well. &amp;nbsp;And changes to the&lt;br&gt;
&amp;gt; listener lists in the list event publisher are changing state, and therefore&lt;br&gt;
&amp;gt; need to be write locked.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I hope that helps!&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; - K&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ----------------------- Original Message -----------------------&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; From: &amp;quot;Sam Berlin&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sberlin@...&lt;/a&gt;&amp;gt;&lt;br&gt;
&amp;gt; To: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users@...&lt;/a&gt;&lt;br&gt;
&amp;gt; Cc:&lt;br&gt;
&amp;gt; Date: Wed, 1 Oct 2008 10:43:33 -0400&lt;br&gt;
&amp;gt; Subject: Re: Debugging Listener Cycles&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; That was going to be my next question. &amp;nbsp;Still, I can see somewhat how&lt;br&gt;
&amp;gt; it&amp;#39;s necessary for something like creating FilterList, since the&lt;br&gt;
&amp;gt; constructor is:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; {&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super(source);&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// build a list of what is filtered and what&amp;#39;s not&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;flagList.addBlack(0, source.size());&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// listen for changes to the source list&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;source.addListEventListener(this);&lt;br&gt;
&amp;gt; }&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; You&amp;#39;d want to make sure the list is blocked from changes during that&lt;br&gt;
&amp;gt; interval, making sure the listener is added while the source doesn&amp;#39;t&lt;br&gt;
&amp;gt; change.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; But, I don&amp;#39;t understand why it&amp;#39;s necessary when doing something just like:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;nbsp;list.addListEventListener(new ListEventListener() {&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void listChanged(ListEvent changes) {&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myComponent.setText(changes.getSourceList().size());&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br&gt;
&amp;gt; &amp;nbsp;});&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; That doesn&amp;#39;t need any atomically-stable state on the list, and looking&lt;br&gt;
&amp;gt; at what happens when you call addListEventListener, it goes something&lt;br&gt;
&amp;gt; like this:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; EventList.addListEventListener -&amp;gt;&lt;br&gt;
&amp;gt; ListEventAssembler.addListEventListener -&amp;gt;&lt;br&gt;
&amp;gt; AssemblerHelper.PublisherAdapter.addListEventListener -&amp;gt;&lt;br&gt;
&amp;gt; SequenceDependenciesEventPublisher.addListener -&amp;gt; {&lt;br&gt;
&amp;gt; updateEventListeners, createSubjectsAndListeners }&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; At the point when it really starts to modify state, the methods&lt;br&gt;
&amp;gt; themselves are synchronized. &amp;nbsp;That is,&lt;br&gt;
&amp;gt; ListEventAssembler.addListEventListener is synchronized, and&lt;br&gt;
&amp;gt; SequenceDependenciesEventPublisher.addListener is also synchronized.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; So I guess I&amp;#39;m a little confused about what&amp;#39;s actually going on.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Thanks,&lt;br&gt;
&amp;gt; Sam&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; On Wed, Oct 1, 2008 at 10:30 AM, Jeremy Ford &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;caius1@...&lt;/a&gt;&amp;gt; wrote:&lt;br&gt;
&amp;gt;&amp;gt; As a follow up, why would you use a read lock vs a write lock when adding&lt;br&gt;
&amp;gt;&amp;gt; listeners to a list?&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Date: Tue, 30 Sep 2008 17:30:17 -0700&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; From: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kevin@...&lt;/a&gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; To: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users@...&lt;/a&gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Subject: re: Debugging Listener Cycles&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Just a guess, but are you grabbing a read lock on the list prior to&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; adding&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; the thread safe wrapper? how about prior to adding listeners?&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; At minimum, I think that describing your locking calls surrounding each&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; of&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; these operations will be useful in determining what might be going on.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; - K&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; -- --------------------- Original Message -----------------------&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; From: &amp;quot;Sam Berlin&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sberlin@...&lt;/a&gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; To: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=8&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users@...&lt;/a&gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Cc:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Date: Tue, 30 Sep 2008 19:55:26 -0400&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Subject: Debugging Listener Cycles&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Hi All,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; I&amp;#39;ve got a strange situation where some race condition (probably in&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; our code, it&amp;#39;s a guess based on it happening sometimes &amp;amp; not others)&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; appears to be triggering an IllegalStateException within GlazedLists,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; the message being, &amp;quot;Listener cycle detected&amp;quot;. Then there&amp;#39;s a bunch of&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; []&amp;#39;s and arrows pointing to numbers. I&amp;#39;m having a very hard time&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; debugging the cause, because I&amp;#39;m not really sure what&amp;#39;s going on.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Our setup is like this:&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; One master CompositeList. Many members of that list (created with&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; CompositeList.createMemberList and added to it appropriately). Each&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; member is then wrapped in a ThreadSafeList and then lazily (on the EDT&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; thread) wrapped in a SwingThreadProxyEventList. The CompositeList is&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; also wrapped in a ThreadSafeList, and that ThreadSafeList is wrapped&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; in a UniqueList. A SwingThreadProxyEventList is lazily created for&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; that UniqueList. Listeners are added to the member&amp;#39;s ThreadSafeList&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; and the STPEL. Listeners are also added to the CompositeList&amp;#39;s STPEL&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; wrapper over the UniqueList.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; What triggers the exception, sometimes, is adding a ThreadSafeList&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; wrapper over a member list. Other times it&amp;#39;s adding a listener to the&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; member&amp;#39;s STPEL wrapper.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; These exceptions all started happeni ng only after CompositeList was&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; introduced -- before that, all member lists were created with new&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; BasicEventList instead of CompositeList.createMemberList. Upon&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; switching to CompositeList, the listener cycle now occasionally starts&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; screaming.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Any suggestions for how to debug or fix this?&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; FWIW, the reason for this approach is: We have essentially a Map&amp;lt;Foo,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; EventList&amp;lt;FooItem&amp;gt;&amp;gt;. Each Foo can have many items associated with it.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Various parts of the program interact with the individual FooItem&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; lists, some even create their own EventList&amp;lt;Foo&amp;gt;, listening for new&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Foo&amp;#39;s being added from other sections. The CompositeList is because&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; we want a separate area that lists the sum-total of FooItems within&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; each EventList&amp;lt;FooItem&amp;gt;, stripping out the uniques.&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Thanks very much in ad vance,&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; Sam&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=9&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=10&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=11&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt; For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=12&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;&lt;br&gt;
&amp;gt;&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; ________________________________&lt;br&gt;
&amp;gt;&amp;gt; See how Windows Mobile brings your life together—at home, work, or on the&lt;br&gt;
&amp;gt;&amp;gt; go. See Now&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; ---------------------------------------------------------------------&lt;br&gt;
&amp;gt; To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=13&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;&lt;br&gt;
&amp;gt; For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=14&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; --------------------------------------------------------------------- To&lt;br&gt;
&amp;gt; unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=15&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt; For&lt;br&gt;
&amp;gt; additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=16&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
---------------------------------------------------------------------&lt;br&gt;
To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=17&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;&lt;br&gt;
For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19765827&amp;i=18&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---User-f2578.html&quot; embed=&quot;fixTarget[2578]&quot; target=&quot;_top&quot; &gt;GlazedLists - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Debugging-Listener-Cycles-tp19752471p19765827.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19763764</id>
	<title>Re: re[2]: Debugging Listener Cycles</title>
	<published>2008-10-01T09:05:18Z</published>
	<updated>2008-10-01T09:05:18Z</updated>
	<author>
		<name>Sam Berlin</name>
	</author>
	<content type="html">It would seem like there should be a TransformedListsFactory that has
&lt;br&gt;create methods for all transformed list subclasses and locks the
&lt;br&gt;source list while creating the sublist, as well as a utility method
&lt;br&gt;that adds listeners under the source list's lock (assuming that's
&lt;br&gt;necessary -- I still don't completely understand why it is).
&lt;br&gt;&lt;br&gt;Sam
&lt;br&gt;&lt;br&gt;On Wed, Oct 1, 2008 at 11:40 AM, Kevin Day &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kevin@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; The place I've run into problems with only grabbing a read lock when adding
&lt;br&gt;&amp;gt; listeners is when you start bridging threads. &amp;nbsp;For example, the list that
&lt;br&gt;&amp;gt; moves events over to the Swing EDT has some extremely funky logic in it to
&lt;br&gt;&amp;gt; ensure that calls are dispatched in an orderly fashion - even if you are
&lt;br&gt;&amp;gt; adding a listener when there are already events in the queue (yes - it's
&lt;br&gt;&amp;gt; really, really nasty - I don't understand the code completely, but I spent
&lt;br&gt;&amp;gt; enough time spelunking during a debugging session awhile back that I
&lt;br&gt;&amp;gt; appreciate the complexity and the reason for it). &amp;nbsp;When it does this, it
&lt;br&gt;&amp;gt; dispatches an event onto the EDT and waits for that event to complete. &amp;nbsp;That
&lt;br&gt;&amp;gt; event, in turn, can wind up having to grab a write lock on the list
&lt;br&gt;&amp;gt; pipeline. &amp;nbsp;This creates a potential race condition if you are just grabbing
&lt;br&gt;&amp;gt; read locks when you add listeners.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; When we implemented our PluggableEventList, we found that if we only grabbed
&lt;br&gt;&amp;gt; a read-lock before adding listeners that we dead-locked sometimes b/c of the
&lt;br&gt;&amp;gt; EDT proxying behavior. &amp;nbsp;Grabbing a write lock is defensive in this regard.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I think the way to explain it is that the readwrite lock is protecting a
&lt;br&gt;&amp;gt; *lot* more than just the contents of the list. &amp;nbsp;The lock is *actually*
&lt;br&gt;&amp;gt; protecting the list event publisher state as well. &amp;nbsp;And changes to the
&lt;br&gt;&amp;gt; listener lists in the list event publisher are changing state, and therefore
&lt;br&gt;&amp;gt; need to be write locked.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I hope that helps!
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; - K
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ----------------------- Original Message -----------------------
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; From: &amp;quot;Sam Berlin&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sberlin@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt; To: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users@...&lt;/a&gt;
&lt;br&gt;&amp;gt; Cc:
&lt;br&gt;&amp;gt; Date: Wed, 1 Oct 2008 10:43:33 -0400
&lt;br&gt;&amp;gt; Subject: Re: Debugging Listener Cycles
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; That was going to be my next question. &amp;nbsp;Still, I can see somewhat how
&lt;br&gt;&amp;gt; it's necessary for something like creating FilterList, since the
&lt;br&gt;&amp;gt; constructor is:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super(source);
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// build a list of what is filtered and what's not
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;flagList.addBlack(0, source.size());
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// listen for changes to the source list
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;source.addListEventListener(this);
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; You'd want to make sure the list is blocked from changes during that
&lt;br&gt;&amp;gt; interval, making sure the listener is added while the source doesn't
&lt;br&gt;&amp;gt; change.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; But, I don't understand why it's necessary when doing something just like:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp;list.addListEventListener(new ListEventListener() {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void listChanged(ListEvent changes) {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myComponent.setText(changes.getSourceList().size());
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; &amp;nbsp;});
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; That doesn't need any atomically-stable state on the list, and looking
&lt;br&gt;&amp;gt; at what happens when you call addListEventListener, it goes something
&lt;br&gt;&amp;gt; like this:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; EventList.addListEventListener -&amp;gt;
&lt;br&gt;&amp;gt; ListEventAssembler.addListEventListener -&amp;gt;
&lt;br&gt;&amp;gt; AssemblerHelper.PublisherAdapter.addListEventListener -&amp;gt;
&lt;br&gt;&amp;gt; SequenceDependenciesEventPublisher.addListener -&amp;gt; {
&lt;br&gt;&amp;gt; updateEventListeners, createSubjectsAndListeners }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; At the point when it really starts to modify state, the methods
&lt;br&gt;&amp;gt; themselves are synchronized. &amp;nbsp;That is,
&lt;br&gt;&amp;gt; ListEventAssembler.addListEventListener is synchronized, and
&lt;br&gt;&amp;gt; SequenceDependenciesEventPublisher.addListener is also synchronized.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; So I guess I'm a little confused about what's actually going on.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks,
&lt;br&gt;&amp;gt; Sam
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Wed, Oct 1, 2008 at 10:30 AM, Jeremy Ford &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;caius1@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; As a follow up, why would you use a read lock vs a write lock when adding
&lt;br&gt;&amp;gt;&amp;gt; listeners to a list?
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Date: Tue, 30 Sep 2008 17:30:17 -0700
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; From: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kevin@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; To: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=5&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Subject: re: Debugging Listener Cycles
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Just a guess, but are you grabbing a read lock on the list prior to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; adding
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; the thread safe wrapper? how about prior to adding listeners?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; At minimum, I think that describing your locking calls surrounding each
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; of
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; these operations will be useful in determining what might be going on.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; - K
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; -- --------------------- Original Message -----------------------
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; From: &amp;quot;Sam Berlin&amp;quot; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=6&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sberlin@...&lt;/a&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; To: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=7&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Cc:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Date: Tue, 30 Sep 2008 19:55:26 -0400
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Subject: Debugging Listener Cycles
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Hi All,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; I've got a strange situation where some race condition (probably in
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; our code, it's a guess based on it happening sometimes &amp; not others)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; appears to be triggering an IllegalStateException within GlazedLists,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; the message being, &amp;quot;Listener cycle detected&amp;quot;. Then there's a bunch of
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; []'s and arrows pointing to numbers. I'm having a very hard time
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; debugging the cause, because I'm not really sure what's going on.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Our setup is like this:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; One master CompositeList. Many members of that list (created with
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; CompositeList.createMemberList and added to it appropriately). Each
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; member is then wrapped in a ThreadSafeList and then lazily (on the EDT
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; thread) wrapped in a SwingThreadProxyEventList. The CompositeList is
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; also wrapped in a ThreadSafeList, and that ThreadSafeList is wrapped
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; in a UniqueList. A SwingThreadProxyEventList is lazily created for
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; that UniqueList. Listeners are added to the member's ThreadSafeList
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; and the STPEL. Listeners are also added to the CompositeList's STPEL
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; wrapper over the UniqueList.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; What triggers the exception, sometimes, is adding a ThreadSafeList
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; wrapper over a member list. Other times it's adding a listener to the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; member's STPEL wrapper.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; These exceptions all started happeni ng only after CompositeList was
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; introduced -- before that, all member lists were created with new
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; BasicEventList instead of CompositeList.createMemberList. Upon
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; switching to CompositeList, the listener cycle now occasionally starts
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; screaming.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Any suggestions for how to debug or fix this?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; FWIW, the reason for this approach is: We have essentially a Map&amp;lt;Foo,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; EventList&amp;lt;FooItem&amp;gt;&amp;gt;. Each Foo can have many items associated with it.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Various parts of the program interact with the individual FooItem
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; lists, some even create their own EventList&amp;lt;Foo&amp;gt;, listening for new
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Foo's being added from other sections. The CompositeList is because
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; we want a separate area that lists the sum-total of FooItems within
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; each EventList&amp;lt;FooItem&amp;gt;, stripping out the uniques.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Thanks very much in ad vance,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Sam
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=8&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=9&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=10&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=11&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; ________________________________
&lt;br&gt;&amp;gt;&amp;gt; See how Windows Mobile brings your life together—at home, work, or on the
&lt;br&gt;&amp;gt;&amp;gt; go. See Now
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt; To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=12&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;
&lt;br&gt;&amp;gt; For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=13&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; --------------------------------------------------------------------- To
&lt;br&gt;&amp;gt; unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=14&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt; For
&lt;br&gt;&amp;gt; additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=15&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;
&lt;/div&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=16&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-unsubscribe@...&lt;/a&gt;
&lt;br&gt;For additional commands, e-mail: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763764&amp;i=17&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users-help@...&lt;/a&gt;
&lt;br&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/GlazedLists---User-f2578.html&quot; embed=&quot;fixTarget[2578]&quot; target=&quot;_top&quot; &gt;GlazedLists - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Debugging-Listener-Cycles-tp19752471p19763764.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19763199</id>
	<title>re[2]: Debugging Listener Cycles</title>
	<published>2008-10-01T08:40:17Z</published>
	<updated>2008-10-01T08:40:17Z</updated>
	<author>
		<name>Kevin Day</name>
	</author>
	<content type="html">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;
&lt;HTML&gt;&lt;HEAD&gt;


&lt;META content=&quot;MSHTML 6.00.2900.3059&quot; name=GENERATOR&gt;&lt;/HEAD&gt;
&lt;BODY leftMargin=1 topMargin=1 rightMargin=1&gt;&lt;FONT face=Arial size=2&gt;
&lt;DIV&gt;The place I've run into problems with only grabbing a read lock when adding listeners is when you start bridging threads.&amp;nbsp; For example, the list that moves events over to the Swing EDT has some extremely funky logic in it to ensure that calls are dispatched in an orderly fashion - even if you are adding a listener when there are already events in the queue (yes - it's really, really nasty - I don't understand the code completely, but I spent enough time spelunking during a debugging session awhile back that I appreciate the complexity and the reason for it).&amp;nbsp; When it does this, it dispatches an event onto the EDT and waits for that event to complete.&amp;nbsp; That event, in turn, can wind up having to grab a write lock on the list pipeline.&amp;nbsp; This creates a potential race condition if you are just grabbing read locks when you add listeners.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;When we implemented our PluggableEventList, we found that if we only grabbed a read-lock before adding listeners that we dead-locked sometimes b/c of the EDT proxying behavior.&amp;nbsp; Grabbing a write lock is defensive in this regard.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I think the way to explain it is that the readwrite lock is protecting a *lot* more than just the contents of the list.&amp;nbsp; The lock is *actually* protecting the list event publisher state as well.&amp;nbsp; And changes to the listener lists in the list event publisher are changing state, and therefore need to be write locked.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I hope that helps!&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;- K&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/FONT&gt;
&lt;DIV style=&quot;FONT-SIZE: x-small; FONT-FAMILY: Tahoma&quot;&gt;
&lt;DIV&gt;----------------------- &lt;B&gt;Original Message&lt;/B&gt; -----------------------&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;B&gt;From:&lt;/B&gt;&amp;nbsp;&quot;Sam Berlin&quot; &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763199&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;sberlin@...&lt;/a&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;B&gt;To:&lt;/B&gt;&amp;nbsp;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763199&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users@...&lt;/a&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;B&gt;Cc:&lt;/B&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;B&gt;Date:&lt;/B&gt;&amp;nbsp;Wed, 1 Oct 2008 10:43:33 -0400&lt;/DIV&gt;
&lt;DIV&gt;&lt;B&gt;Subject:&amp;nbsp;&lt;U&gt;Re: Debugging Listener Cycles&lt;/U&gt;&lt;/B&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;FONT face=Tahoma size=2&gt;
&lt;DIV&gt;That was going to be my next question. &amp;nbsp;Still, I can see somewhat how&lt;BR&gt;it's necessary for something like creating FilterList, since the&lt;BR&gt;constructor is:&lt;BR&gt;&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;super(source);&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// build a list of what is filtered and what's not&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;flagList.addBlack(0, source.size());&lt;BR&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// listen for changes to the source list&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;source.addListEventListener(this);&lt;BR&gt;}&lt;BR&gt;&lt;BR&gt;You'd want to make sure the list is blocked from changes during that&lt;BR&gt;interval, making sure the listener is added while the source doesn't&lt;BR&gt;change.&lt;BR&gt;&lt;BR&gt;But, I don't understand why it's necessary when doing something just like:&lt;BR&gt;&lt;BR&gt;&amp;nbsp;list.addListEventListener(new ListEventListener() {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public void listChanged(ListEvent changes) {&lt;B R&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;myComponent.setText(changes.getSourceList().size());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR&gt;&amp;nbsp;});&lt;BR&gt;&lt;BR&gt;That doesn't need any atomically-stable state on the list, and looking&lt;BR&gt;at what happens when you call addListEventListener, it goes something&lt;BR&gt;like this:&lt;BR&gt;&lt;BR&gt;EventList.addListEventListener -&amp;gt;&lt;BR&gt;ListEventAssembler.addListEventListener -&amp;gt;&lt;BR&gt;AssemblerHelper.PublisherAdapter.addListEventListener -&amp;gt;&lt;BR&gt;SequenceDependenciesEventPublisher.addListener -&amp;gt; {&lt;BR&gt;updateEventListeners, createSubjectsAndListeners }&lt;BR&gt;&lt;BR&gt;At the point when it really starts to modify state, the methods&lt;BR&gt;themselves are synchronized. &amp;nbsp;That is,&lt;BR&gt;ListEventAssembler.addListEventListener is synchronized, and&lt;BR&gt;SequenceDependenciesEventPublisher.addListener is also synchronized.&lt;BR&gt;&lt;BR&gt;So I guess I'm a little confused about what's actually going on.&lt;BR&gt;&lt;BR&gt;Thanks,&lt;BR&gt;Sam&lt;BR&gt;&lt;BR&gt;On Wed, Oct 1, 2008 
 at 10:30 AM, Jeremy Ford &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763199&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;caius1@...&lt;/a&gt; wrote:&lt;div class='shrinkable-quote'&gt;&lt;BR&gt;&amp;gt; As a follow up, why would you use a read lock vs a write lock when adding&lt;BR&gt;&amp;gt; listeners to a list?&lt;BR&gt;&amp;gt;&lt;BR&gt;&amp;gt;&amp;gt; Date: Tue, 30 Sep 2008 17:30:17 -0700&lt;BR&gt;&amp;gt;&amp;gt; From: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763199&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;kevin@...&lt;/a&gt;&lt;BR&gt;&amp;gt;&amp;gt; To: &lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19763199&amp;i=4&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;users@...&lt;/a&gt;&lt;BR&gt;&amp;gt;&amp;gt; Subject: re: Debugging Listener Cycles&lt;BR&gt;&amp;gt;&amp;gt;&lt;BR&gt;&amp;gt;&amp;gt; Just a guess, but are you grabbing a read lock on the list prior to adding&lt;BR&gt;&amp;gt;&amp;gt; the thread safe wrapper? how about prior to adding listeners?&lt;BR&gt;&amp;gt;&amp;gt;&lt;BR&gt;&amp;g