ConcurrentModification-Exception in ViewportLayer(?) [message #1719472] |
Fri, 08 January 2016 09:02 |
|
Hi everyone,
I'm using NatTable to display a rather large and dynamic set of entries.
The update ratio is very variable, varying from 0 entries per minute to several hundreds per second.
My underlying data structure is a combination of GlazedLists (EventList -> ObservableList -> FilterList -> SortedList).
Now sometimes I get this exception:
Most of the time it happens right at the beginning, but it also happens after serveral minutes.
So far as I can see it happens either if too many events travel up the layer-stack in a rather short amount of time or if 2 or more different events reach the ViewportLayer at the same time (like a PropertyChangeEvent from the ObservableList and a StructuralChangEvent from the EventList). But I'm only guessing at this point.
I build the natTable like this:
I hope you can help me with this,
regards Dennis
|
|
|
|
Re: ConcurrentModification-Exception in ViewportLayer(?) [message #1719547 is a reply to message #1719544] |
Fri, 08 January 2016 18:30 |
|
Hi Dirk,
I'm using the current version of the NatTable (or so I believe, Build #465). I think I determind the source of the problem. My AutoScrollHandler is listening to RowStructuralChangeEvents. Each time it receives one it determines the last row and triggers moveRowPositionIntoView() of the ViewportLayer. If I understand the source code there correctly this method is registering an EventHandler and 100ms later it unregisters the same one.
When at the same time any other event is handled by the ViewportLayer the ConcurrentModification-Exception occurs.
I'm fresh out of ideas I could try in my own code to prevent this, but i believe if the ViewportLayer would override handleLayerEvent(), registerEventHandler() and the unregisterEventHandler() this could work.
By using a lock object the ViewportLayer could acquire a read-lock before iterating over the eventHandler map and a write-lock before adding or removing a handler. This souldn't decrease the performance by much and it should increase thread-safety for the eventHandlers.
Regards Dennis
[Updated on: Fri, 08 January 2016 18:34] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03749 seconds