Closed maarzt closed 1 year ago
This PR is ready to be reviewed & merged. (It provides a very straight forward solution to the concurrent modification problem. Modifications to the ModelBranchGraph are now protected by a ReadWriteLock in a similar fashion as this is done for the ModelGraph.)
This PR fixes a ConcurrentModificationException, that occurs on some datasets, when the TrackScheme Hierarchy window is opened the first time. Here is the stack trace of this exception:
The TrackScheme Hierarchy window is not rendered properly since the exception cancels the
PainterThread
:The window can be closed and reopened to workaround this problem.
Root cause
The problem is caused by multi threading. The branch graph is rebuild by the
BranchGraphSynchronizer
when the TrackScheme Heirarchy window is show. The branch graph rebuild also triggers a rebuild to theTrackSchemeGraph
that is associated with the branch graph. TheConcurrentModificationException
happens when thePainterThread
renders theTrackSchemeGraph
while it is modified.Solution
The problem can be fixed by introducing a read-write-lock that prevents a simultaneous modification and rendering of the
BranchGraph
and it's associatedTrackSchemeGraph
.ReentrantReadWriteLock
to theModelBranchGraph
.graphRebuilt
method of theModelBranchGraph
.TrackSchemeGraph
.