[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: [CDO 1.0] weak references and adapters

Eike,

It seems to me that adding an adapter to an object that is in an open view is implicitly saying, "I am interested in this object. Please keep me notified of when it changes." Given that CDOViews are "partial views on the repository", it makes sense that things would get GC'ed out of them when no one is paying attention to them, but if I attach an adapter to an object it seems to me that I'm expressing interest in it, and therefore it should be maintained as part of the view. What if objects with adapters attached to them were maintained in a separate Strong reference map?

Eike Stepper wrote:

Tom,

I see it as one of the hidden but main advantages of CDO that the EObjects can be silently discarded from memory when it runs low and automatically recreated when they are needed again. And you're right, I didn't think about existing adapters. Can you please open an enhancement request and make a proposal on how exactly you'd like to have it configurable?

Cheers
/Eike


Tom Crockett schrieb:
I've been fighting a very insidious bug for the last 3 days in which adapters I attached to my shared model were mysteriously disappearing. I couldn't find any place where they were getting removed, so I was really mystified for a long time. Today I finally figured out that it was because of the fact that CDOViewImpl stores its objects in a weak ReferenceValueMap, so they were getting GC'ed, along with their adapters! I worked around this fairly easily by attaching an EContentAdapter when first loading a resource which recursively maintains strong references to every object in the view, but I just wanted to mention this for anyone who may be experiencing such problems. Also, I wanted to ask whether this behavior might be made configurable, if it already hasn't, for CDO 2.0.