Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsGlobal AdapterFactory vs one per each EditingDomain
https://www.eclipse.org/forums/index.php/mv/msg/370365/904383/#msg_904383
What are the differences of using the same instance of an AdapterFactory with all loaded EditingDomains over using an AdapterFactory per each loaded EditingDomain?
The first difference that comes to my mind is that when using a global AdapterFactory, only a single set of item providers exist whereas using one per each EditingDomain would result in a set of item providers for each domain.
Is the performance (memory, speed) of the overall EMF mechanism affected in any way by using a global instance?
What are the other important/notable differences?
Thank you in advance,
Sorin.]]>Sorin Fagateanu2012-08-28T10:59:37-00:00Re: Global AdapterFactory vs one per each EditingDomain
https://www.eclipse.org/forums/index.php/mv/msg/370365/904415/#msg_904415
Comments below.
On 28/08/2012 12:59 PM, Sorin Fagateanu wrote:
> Hello,
>
> What are the differences of using the same instance of an
> AdapterFactory with all loaded EditingDomains over using an
> AdapterFactory per each loaded EditingDomain?
Which adapter factory specifically are you referring to?
> The first difference that comes to my mind is that when using a global
> AdapterFactory, only a single set of item providers exist whereas
> using one per each EditingDomain would result in a set of item
> providers for each domain.
So item provider adapters... If you have the adapter factory global,
you also have the issue of the adapters holding references to the
objects loaded by the editor after the editor closes. This will result
in a huge memory leak.
>
> Is the performance (memory, speed) of the overall EMF mechanism
> affected in any way by using a global instance?
Ensuring that such global adapters don't hang onto the objects is a
significant concern. You'd need to call unload on all the resources in
the editor to ensure that their adapter lists are clear and hence that
the adapters remove their references to them.
> What are there other important/notable differences?
I think there's very little to be gained by keeping the item provider
adapters globally. They're generally stateless singletons so don't take
up much space on their own.
>
> Thank you in advance,
> Sorin.]]>Ed Merks2012-08-28T11:43:13-00:00Re: Global AdapterFactory vs one per each EditingDomain
https://www.eclipse.org/forums/index.php/mv/msg/370365/905341/#msg_905341
Thank you for your time and answers.
I was referring to the adapterFactory of the AdaterFactoryEditingDomain and I wanted to be sure that the way I understand adapter factories and item providers is correct.