vitruv-tools / Vitruv-Domains-ComponentBasedSystems

Vitruv domains for component-based systems
Eclipse Public License 1.0
1 stars 7 forks source link

Avoid Locks in Java Monitored Editor to Allow Multiple Jobs Accessing It #76

Closed HeikoKlare closed 3 years ago

HeikoKlare commented 3 years ago

Processing a change event must be possible without locking the JavaMonitoredEditor. Otherwise a change propagation may be running (which needs to lock the JavaMonitoredEditor), but since it is run within a build Job, it in turn waits for the resource change Job to finish, which cannot proceed as it waits for the lock acquired by the change propagation Job. This is a classical deadlock.

In fact, we have used locking to avoid that multiple change processing or change propagation processes / jobs are running at the same time, whereas it should be specifically used to avoid race conditions and ensure memory consistency. This PR reduces the synchronization to what is absolutely necessary.