Atom Feed SITE FEED   ADD TO GOOGLE READER

Event Listeners and dependencies

There was a recent bug in Glazed Lists that was difficult to plan for. Consider this:
- "S", a source list
- "F1", a filtered transformation of "S"
- "F2", a filtered transformation of "S"
- "FF", a filtered transformation of "F1" that also depends on "F2"

When "S" changes, an event is sent to "F1", which in turn forwards the event to "FF". This returns and then "S" sends the event to "F2". But when "FF" is notified, it inspects "F2", which has not yet received the event from "S". This causes "F2" to be in an inconsistent state, and erratic behaviour ensues. In this case an ArrayIndexOutOfBounds exception was being thrown.

The problem was that although "S" was up-to-date, "FF" was looking at "F2", which was not yet up to date.

The end solution involves explicitly managing the dependencies of each ListEventListener. Now "S" fires an event to "F1", but "F1" does NOT forward it to "FF". Instead, "F1" returns and "S" proceeds to forward the event to "F2". Finally the event is forwarded as if it came from "F1".

Nasty! The code will be in CVS tonight, probably.