Home » Modeling » EMF » [CDO] Usage of setStrongReferencePolicy
[CDO] Usage of setStrongReferencePolicy [message #1710519] |
Wed, 07 October 2015 09:41 |
|
Hello,
In the javadoc of
CDOView.Options.setStrongReferencePolicy(CDOAdapterPolicy), we can read
that:
Sets the reference type to be used when an adapter is used to an object.
When CDOView.setStrongReference(CDOAdapterPolicy.ALL) is used, it is
possible that the target object will be GC. In that case, the adapter
will never received notifications. By Default the value is at
CDOAdapterPolicy.ALL.
I feel that CDOAdapterPolicy.NONE provides a GC and not
CDOAdapterPolicy.ALL. Can someone confirm that the javadoc is false?
In our case, with option strongReferencePolicy set to
CDOAdapterPolicy.NONE, after a break of 10 minutes, we have some
EObjects without their original eAdapters. This is not the case with
CDOAdapterPolicy.ALL.
With option set to CDOAdapterPolicy.NONE, the
CDORevisionCacheNonAuditing "cleans" the softReferences after about 10
minutes (AbstractCDORevisionCache.work(Reference<? extends
InternalCDORevision>).
Best regards,
--
Laurent Redor - Obeo
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: [CDO] Usage of setStrongReferencePolicy [message #1710525 is a reply to message #1710519] |
Wed, 07 October 2015 10:08 |
|
Hi Laurent,
By default a CDOView has the strong reference policy CDOAdapterPolicy.ALL, which creates extra strong references (in
addition to the soft references that the view maintains anyway) to all objects that have adapters, which effectively
prevents these objects from being garbage collected until all adapters are removed (or the policy is changed).
If you set the strong reference policy of a view to CDOAdapterPolicy.NONE (or to any other policy that doesn't create
extra strong references to all adapted objects) objects may end up with only the internal soft references even though
they still have adapters attached. These objects can happen to be garbage collected and when you navigate to them again,
new objects will be created. These new objects will miss the original adapters.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Am 07.10.2015 um 11:41 schrieb Laurent Redor:
> Hello,
>
> In the javadoc of CDOView.Options.setStrongReferencePolicy(CDOAdapterPolicy), we can read that:
> Sets the reference type to be used when an adapter is used to an object.
> When CDOView.setStrongReference(CDOAdapterPolicy.ALL) is used, it is possible that the target object will be GC. In
> that case, the adapter will never received notifications. By Default the value is at CDOAdapterPolicy.ALL.
>
> I feel that CDOAdapterPolicy.NONE provides a GC and not CDOAdapterPolicy.ALL. Can someone confirm that the javadoc is
> false?
>
> In our case, with option strongReferencePolicy set to CDOAdapterPolicy.NONE, after a break of 10 minutes, we have some
> EObjects without their original eAdapters. This is not the case with CDOAdapterPolicy.ALL.
> With option set to CDOAdapterPolicy.NONE, the CDORevisionCacheNonAuditing "cleans" the softReferences after about 10
> minutes (AbstractCDORevisionCache.work(Reference<? extends InternalCDORevision>).
>
> Best regards,
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Usage of setStrongReferencePolicy [message #1710535 is a reply to message #1710525] |
Wed, 07 October 2015 11:10 |
|
Thanks Eike for your response.
That confirms that the javadoc should be
When CDOView.setStrongReference(CDOAdapterPolicy.NONE) is used, it is
possible that the target object will be GC.
or
When CDOView.setStrongReference(CDOAdapterPolicy.ALL) is not used, it is
possible that the target object will be GC.
Le 07/10/2015 12:08, Eike Stepper a écrit :
> Hi Laurent,
>
> By default a CDOView has the strong reference policy
> CDOAdapterPolicy.ALL, which creates extra strong references (in addition
> to the soft references that the view maintains anyway) to all objects
> that have adapters, which effectively prevents these objects from being
> garbage collected until all adapters are removed (or the policy is
> changed).
>
> If you set the strong reference policy of a view to
> CDOAdapterPolicy.NONE (or to any other policy that doesn't create extra
> strong references to all adapted objects) objects may end up with only
> the internal soft references even though they still have adapters
> attached. These objects can happen to be garbage collected and when you
> navigate to them again, new objects will be created. These new objects
> will miss the original adapters.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
> Am 07.10.2015 um 11:41 schrieb Laurent Redor:
>> Hello,
>>
>> In the javadoc of
>> CDOView.Options.setStrongReferencePolicy(CDOAdapterPolicy), we can
>> read that:
>> Sets the reference type to be used when an adapter is used to an object.
>> When CDOView.setStrongReference(CDOAdapterPolicy.ALL) is used, it is
>> possible that the target object will be GC. In that case, the adapter
>> will never received notifications. By Default the value is at
>> CDOAdapterPolicy.ALL.
>>
>> I feel that CDOAdapterPolicy.NONE provides a GC and not
>> CDOAdapterPolicy.ALL. Can someone confirm that the javadoc is false?
>>
>> In our case, with option strongReferencePolicy set to
>> CDOAdapterPolicy.NONE, after a break of 10 minutes, we have some
>> EObjects without their original eAdapters. This is not the case with
>> CDOAdapterPolicy.ALL.
>> With option set to CDOAdapterPolicy.NONE, the
>> CDORevisionCacheNonAuditing "cleans" the softReferences after about 10
>> minutes (AbstractCDORevisionCache.work(Reference<? extends
>> InternalCDORevision>).
>>
>> Best regards,
>>
>
--
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Laurent Redor - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: [CDO] Usage of setStrongReferencePolicy [message #1710568 is a reply to message #1710535] |
Wed, 07 October 2015 14:55 |
|
Am 07.10.2015 um 13:10 schrieb Laurent Redor:
> Thanks Eike for your response.
>
> That confirms that the javadoc should be
>
> When CDOView.setStrongReference(CDOAdapterPolicy.NONE) is used, it is possible that the target object will be GC.
>
> or
>
> When CDOView.setStrongReference(CDOAdapterPolicy.ALL) is not used, it is possible that the target object will be GC.
You're right. I've changed the docs. Thanks for the hint!
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
>
>
> Le 07/10/2015 12:08, Eike Stepper a écrit :
>> Hi Laurent,
>>
>> By default a CDOView has the strong reference policy
>> CDOAdapterPolicy.ALL, which creates extra strong references (in addition
>> to the soft references that the view maintains anyway) to all objects
>> that have adapters, which effectively prevents these objects from being
>> garbage collected until all adapters are removed (or the policy is
>> changed).
>>
>> If you set the strong reference policy of a view to
>> CDOAdapterPolicy.NONE (or to any other policy that doesn't create extra
>> strong references to all adapted objects) objects may end up with only
>> the internal soft references even though they still have adapters
>> attached. These objects can happen to be garbage collected and when you
>> navigate to them again, new objects will be created. These new objects
>> will miss the original adapters.
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>
>> Am 07.10.2015 um 11:41 schrieb Laurent Redor:
>>> Hello,
>>>
>>> In the javadoc of
>>> CDOView.Options.setStrongReferencePolicy(CDOAdapterPolicy), we can
>>> read that:
>>> Sets the reference type to be used when an adapter is used to an object.
>>> When CDOView.setStrongReference(CDOAdapterPolicy.ALL) is used, it is
>>> possible that the target object will be GC. In that case, the adapter
>>> will never received notifications. By Default the value is at
>>> CDOAdapterPolicy.ALL.
>>>
>>> I feel that CDOAdapterPolicy.NONE provides a GC and not
>>> CDOAdapterPolicy.ALL. Can someone confirm that the javadoc is false?
>>>
>>> In our case, with option strongReferencePolicy set to
>>> CDOAdapterPolicy.NONE, after a break of 10 minutes, we have some
>>> EObjects without their original eAdapters. This is not the case with
>>> CDOAdapterPolicy.ALL.
>>> With option set to CDOAdapterPolicy.NONE, the
>>> CDORevisionCacheNonAuditing "cleans" the softReferences after about 10
>>> minutes (AbstractCDORevisionCache.work(Reference<? extends
>>> InternalCDORevision>).
>>>
>>> Best regards,
>>>
>>
>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Goto Forum:
Current Time: Sat Apr 20 02:28:29 GMT 2024
Powered by FUDForum. Page generated in 0.03464 seconds
|