Community
Participate
Working Groups
Applications that work with UML have to be very careful about cleaning up a ResourceSet when they have finished with it, because UML's singleton CacheAdapter otherwise retains the entire contents of the resource set in memory indefinitely. As such, it is common practice to do the following: 1. Unload all resources in the resource set (this clears the adapter list of every model object). 2. Clear the adapter list of every resource in the resource set. 2. Clear the resource set's resources list. 3. Clear the adapter list of the resource set. This ensures that the CacheAdapter and any other adapters are all purged and that the CacheAdapter, in particular, won't leak anything. However, doing this with a resource set that was used for a CDO view results in an IllegalArgumentException because the CDOViewSetImpl.setTarget() method asserts that the new target is a ResourceSet, but null isn't a ResourceSet. It should be safe to disconnect a CDOViewSet from its ResourceSet when * all resources are unloaded and removed from the resource set * all associated views are closed and removed from the view set
Created attachment 226210 [details] Patch for code review Attached a patch that includes JUnit tests and a fix, implementing my suggestion of allowing the resource set to be unlinked if and only if the resource set has no resources and the view set has no views. It is up to applications to ensure this requirement, but so far my integration of CDO into Papyrus did that fairly naturally.
Adding Papyrus CDO umbrella enhancement as a dependent.
When is the commit freeze for M5? It would be nice to get this change in for M5, so that Papyrus can pick it up. Otherwise, I do have a hack that I can use in Papyrus to block attempts to remove the CDOViewSet from the ResourceSet's adapter list ...
Changing to 4.2, given that you asked for M5 ;-)
I've committed the change for you: commit 12b83fb6876204888f5de840e2e9b2a13fe56d6e
(In reply to comment #3) > When is the commit freeze for M5? We're a small team and focus on productivity and efficiency - we don't have commit freezes :P The +2 day is usually the last chance to get something in, if it's trivial or has been reviewed/tested before.
Available in R20130613-1157 (4.2)