Closed eclipse-capella-bot closed 3 years ago
sandu.postaru commented on 2020-10-23
In this addon, after the requirements are imported we need to save two resources:
The melodymodeller resource
The bridgetraces resource
Both of these resources were saved by doing
resource.save()
Generally when resources are saved, the buffer used to save the resource can be flushed multiple times if the resource content is bigger than the buffer. For resources that are not saved in a WorkspaceRunnable, the workspace detects that a resource has changed and notifies any listener that is registered to the event. The problem is that if multiple flushes are required, the file is incomplete for all flushes except the last one, so the listeners that are registered fail since the resource is corrupted. And once the listener fail, everything fails.
Only the last flush should generated a notification.
When the save is run in a WorkspaceRunnable the notification cycle is managed by the workspace, so the listeners are notified only at the last flush.
Furthermore, since the melodymodeller resource was not saved using the Sirius Session API, after the save Sirius wrongfully detected a resource change, so he unloaded the "old" resource and loaded the "new one". The Sirius Session API should be used to save the session.
First of all this is not needed, second of all this induces performance issues for big models since the whole resource is unloaded and reloaded, it's even worse than a session opening.
The purpose of this ticket is to fix both points:
The error related to the resource save
The performance issues caused by an unnecessary reload of the melodymodeller resource.
philippe.dul commented on 2021-01-06
fixed
🆔 ECLIPSE-568173
👷 sandu.postaru
📅 2020-10-23
🔎 0.10.3