Home » Modeling » EMF » [CDO?] Notifications when reference is set to 'null'
[CDO?] Notifications when reference is set to 'null' [message #1235099] |
Thu, 23 January 2014 15:24 |
Jon Doe Messages: 7 Registered: June 2012 |
Junior Member |
|
|
Hello,
having classes 'A' and 'B', with 'A.b' referencing/containing instances
of 'B', I stumbled over the following oddity when setting 'A.b' to null:
Other "local" views and transactions [from same CDOSession] do *not* get
notified when 'A.b' is set to 'null', but they get notified when the
reference is changed to another instance of 'B'.
In other clients ["remote"], changes are visible immediately --
regardless if 'A.b' is set to 'null' or another instance of 'B'.
(So the client which sets to 'null' does NOT reflect the changes, but
all other clients do so)
On the one hand I might have overseen something obvious to those who
know what they're doing, on the other hand I'm a bit confused why things
work for "remote" clients as expectedly.
In short:
EMFObservables.observeValue((A) instance, (EReference) bReference);
(Value)ChangeListeners fire for local modifications != 'null', and all
remote modifications regardless of value.
Now I feel lost -- thanks in advance.
|
|
|
Re: [CDO] Notifications when reference is set to 'null' (#367738?) [message #1235626 is a reply to message #1235099] |
Fri, 24 January 2014 20:59 |
Jon Doe Messages: 7 Registered: June 2012 |
Junior Member |
|
|
Looking deeper into the matter, something seems to be wrong with
'oldValue's of Notifications.
Btw, this is Eclipse 4.3.1 with CDO 4.2 20130918 on Linux.
As mentioned, my application (= e.g. bound Viewers..) does not react on
the "local" change of a reference to value 'null'. Viewers and listeners
react on changing references to *other* (non-null) values, and they
react on changes to value 'null' when the change was committed from
another session(sic).
Bug 367738, result of ~2 years old thread "[CDO]
Notification#getOldValue always null?", was apparently closed to sudden
lack of any interest.
[ https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 ]
According to that thread, the original poster encountered unexpected
'oldValue's valued 'null'.
My problem also seems to be related to getting unexpected 'oldValue's of
value 'null'".
My (local) Viewers do not react, because method "isTouch", in class
org.eclipse.emf.common.notify.impl.NotificationImpl for event-types
(non-primitive-)SET and UNSET returns:
oldValue == null ? newValue == null : oldValue.equals(newValue)
In my case (local change), and --probably same issue as for the creator
of bug 367738--, 'oldValue' is (incorrectly? but always) null, so when
newValue [UNSET/SET value 'null'] is 'null', too - local Viewers will
not update.
--
For me personally I hacked kindof
if type==UNSET then oldValue=new Object()
into org.eclipse.emf.internal.cdo.object.CDONotificationBuilder to fool
this rule, and .. I do get my updates.
--
I personally am too new to all this to dare to call this a bug, but when
changing a reference from "anything non-null" to "null", or when
unsetting a reference, oldValue should not be null.
Let me know if this is by intention and how to safely work around in
that case.
On 23.01.2014 16:24, Jon Doe wrote:
> Hello,
>
> having classes 'A' and 'B', with 'A.b' referencing/containing instances
> of 'B', I stumbled over the following oddity when setting 'A.b' to null:
>
> Other "local" views and transactions [from same CDOSession] do *not* get
> notified when 'A.b' is set to 'null', but they get notified when the
> reference is changed to another instance of 'B'.
>
> In other clients ["remote"], changes are visible immediately --
> regardless if 'A.b' is set to 'null' or another instance of 'B'.
> (So the client which sets to 'null' does NOT reflect the changes, but
> all other clients do so)
>
>
> On the one hand I might have overseen something obvious to those who
> know what they're doing, on the other hand I'm a bit confused why things
> work for "remote" clients as expectedly.
>
>
> In short:
> EMFObservables.observeValue((A) instance, (EReference) bReference);
>
> (Value)ChangeListeners fire for local modifications != 'null', and all
> remote modifications regardless of value.
>
>
> Now I feel lost -- thanks in advance.
>
|
|
|
Re: [CDO] Notifications when reference is set to 'null' (#367738?) [message #1242282 is a reply to message #1235626] |
Sun, 09 February 2014 09:12 |
|
I've reopened https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 and added the information you've prvided here.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Am 24.01.2014 21:59, schrieb Jon Doe:
> Looking deeper into the matter, something seems to be wrong with
> 'oldValue's of Notifications.
>
> Btw, this is Eclipse 4.3.1 with CDO 4.2 20130918 on Linux.
>
> As mentioned, my application (= e.g. bound Viewers..) does not react on
> the "local" change of a reference to value 'null'. Viewers and listeners
> react on changing references to *other* (non-null) values, and they
> react on changes to value 'null' when the change was committed from
> another session(sic).
>
> Bug 367738, result of ~2 years old thread "[CDO]
> Notification#getOldValue always null?", was apparently closed to sudden
> lack of any interest.
> [ https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 ]
>
> According to that thread, the original poster encountered unexpected
> 'oldValue's valued 'null'.
>
> My problem also seems to be related to getting unexpected 'oldValue's of
> value 'null'".
>
> My (local) Viewers do not react, because method "isTouch", in class
> org.eclipse.emf.common.notify.impl.NotificationImpl for event-types
> (non-primitive-)SET and UNSET returns:
>
> oldValue == null ? newValue == null : oldValue.equals(newValue)
>
>
> In my case (local change), and --probably same issue as for the creator
> of bug 367738--, 'oldValue' is (incorrectly? but always) null, so when
> newValue [UNSET/SET value 'null'] is 'null', too - local Viewers will
> not update.
>
>
> --
> For me personally I hacked kindof
>
> if type==UNSET then oldValue=new Object()
>
> into org.eclipse.emf.internal.cdo.object.CDONotificationBuilder to fool
> this rule, and .. I do get my updates.
> --
>
>
> I personally am too new to all this to dare to call this a bug, but when
> changing a reference from "anything non-null" to "null", or when
> unsetting a reference, oldValue should not be null.
>
> Let me know if this is by intention and how to safely work around in
> that case.
>
>
>
>
> On 23.01.2014 16:24, Jon Doe wrote:
>> Hello,
>>
>> having classes 'A' and 'B', with 'A.b' referencing/containing instances
>> of 'B', I stumbled over the following oddity when setting 'A.b' to null:
>>
>> Other "local" views and transactions [from same CDOSession] do *not* get
>> notified when 'A.b' is set to 'null', but they get notified when the
>> reference is changed to another instance of 'B'.
>>
>> In other clients ["remote"], changes are visible immediately --
>> regardless if 'A.b' is set to 'null' or another instance of 'B'.
>> (So the client which sets to 'null' does NOT reflect the changes, but
>> all other clients do so)
>>
>>
>> On the one hand I might have overseen something obvious to those who
>> know what they're doing, on the other hand I'm a bit confused why things
>> work for "remote" clients as expectedly.
>>
>>
>> In short:
>> EMFObservables.observeValue((A) instance, (EReference) bReference);
>>
>> (Value)ChangeListeners fire for local modifications != 'null', and all
>> remote modifications regardless of value.
>>
>>
>> Now I feel lost -- thanks in advance.
>>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Notifications when reference is set to 'null' (#367738?) [message #1243237 is a reply to message #1242282] |
Mon, 10 February 2014 18:07 |
|
Now I've added a test case and it succeeds. Please CC yourself to https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738
and let me know if that covers your scenario ;-)
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Am 09.02.2014 10:12, schrieb Eike Stepper:
> I've reopened https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 and added the information you've prvided here.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
> Am 24.01.2014 21:59, schrieb Jon Doe:
>> Looking deeper into the matter, something seems to be wrong with
>> 'oldValue's of Notifications.
>>
>> Btw, this is Eclipse 4.3.1 with CDO 4.2 20130918 on Linux.
>>
>> As mentioned, my application (= e.g. bound Viewers..) does not react on
>> the "local" change of a reference to value 'null'. Viewers and listeners
>> react on changing references to *other* (non-null) values, and they
>> react on changes to value 'null' when the change was committed from
>> another session(sic).
>>
>> Bug 367738, result of ~2 years old thread "[CDO]
>> Notification#getOldValue always null?", was apparently closed to sudden
>> lack of any interest.
>> [ https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 ]
>>
>> According to that thread, the original poster encountered unexpected
>> 'oldValue's valued 'null'.
>>
>> My problem also seems to be related to getting unexpected 'oldValue's of
>> value 'null'".
>>
>> My (local) Viewers do not react, because method "isTouch", in class
>> org.eclipse.emf.common.notify.impl.NotificationImpl for event-types
>> (non-primitive-)SET and UNSET returns:
>>
>> oldValue == null ? newValue == null : oldValue.equals(newValue)
>>
>>
>> In my case (local change), and --probably same issue as for the creator
>> of bug 367738--, 'oldValue' is (incorrectly? but always) null, so when
>> newValue [UNSET/SET value 'null'] is 'null', too - local Viewers will
>> not update.
>>
>>
>> --
>> For me personally I hacked kindof
>>
>> if type==UNSET then oldValue=new Object()
>>
>> into org.eclipse.emf.internal.cdo.object.CDONotificationBuilder to fool
>> this rule, and .. I do get my updates.
>> --
>>
>>
>> I personally am too new to all this to dare to call this a bug, but when
>> changing a reference from "anything non-null" to "null", or when
>> unsetting a reference, oldValue should not be null.
>>
>> Let me know if this is by intention and how to safely work around in
>> that case.
>>
>>
>>
>>
>> On 23.01.2014 16:24, Jon Doe wrote:
>>> Hello,
>>>
>>> having classes 'A' and 'B', with 'A.b' referencing/containing instances
>>> of 'B', I stumbled over the following oddity when setting 'A.b' to null:
>>>
>>> Other "local" views and transactions [from same CDOSession] do *not* get
>>> notified when 'A.b' is set to 'null', but they get notified when the
>>> reference is changed to another instance of 'B'.
>>>
>>> In other clients ["remote"], changes are visible immediately --
>>> regardless if 'A.b' is set to 'null' or another instance of 'B'.
>>> (So the client which sets to 'null' does NOT reflect the changes, but
>>> all other clients do so)
>>>
>>>
>>> On the one hand I might have overseen something obvious to those who
>>> know what they're doing, on the other hand I'm a bit confused why things
>>> work for "remote" clients as expectedly.
>>>
>>>
>>> In short:
>>> EMFObservables.observeValue((A) instance, (EReference) bReference);
>>>
>>> (Value)ChangeListeners fire for local modifications != 'null', and all
>>> remote modifications regardless of value.
>>>
>>>
>>> Now I feel lost -- thanks in advance.
>>>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Notifications when reference is set to 'null' (#367738?) [message #1245208 is a reply to message #1243237] |
Thu, 13 February 2014 13:13 |
Jon Doe Messages: 7 Registered: June 2012 |
Junior Member |
|
|
there's one difference in your test-case compared to my scenario:
I assume property 'name' is a simple string, not a reference to some
other instance.
(If I had a/"the" CDO-test-environment already configured here, I would
have added an appropiate testcase -- sorry for now)
On 10.02.2014 19:07, Eike Stepper wrote:
> Now I've added a test case and it succeeds. Please CC yourself to
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 and let me know if
> that covers your scenario ;-)
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
> Am 09.02.2014 10:12, schrieb Eike Stepper:
>> I've reopened https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 and
>> added the information you've prvided here.
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>> Am 24.01.2014 21:59, schrieb Jon Doe:
>>> Looking deeper into the matter, something seems to be wrong with
>>> 'oldValue's of Notifications.
>>>
>>> Btw, this is Eclipse 4.3.1 with CDO 4.2 20130918 on Linux.
>>>
>>> As mentioned, my application (= e.g. bound Viewers..) does not react on
>>> the "local" change of a reference to value 'null'. Viewers and listeners
>>> react on changing references to *other* (non-null) values, and they
>>> react on changes to value 'null' when the change was committed from
>>> another session(sic).
>>>
>>> Bug 367738, result of ~2 years old thread "[CDO]
>>> Notification#getOldValue always null?", was apparently closed to sudden
>>> lack of any interest.
>>> [ https://bugs.eclipse.org/bugs/show_bug.cgi?id=367738 ]
>>>
>>> According to that thread, the original poster encountered unexpected
>>> 'oldValue's valued 'null'.
>>>
>>> My problem also seems to be related to getting unexpected 'oldValue's of
>>> value 'null'".
>>>
>>> My (local) Viewers do not react, because method "isTouch", in class
>>> org.eclipse.emf.common.notify.impl.NotificationImpl for event-types
>>> (non-primitive-)SET and UNSET returns:
>>>
>>> oldValue == null ? newValue == null : oldValue.equals(newValue)
>>>
>>>
>>> In my case (local change), and --probably same issue as for the creator
>>> of bug 367738--, 'oldValue' is (incorrectly? but always) null, so when
>>> newValue [UNSET/SET value 'null'] is 'null', too - local Viewers will
>>> not update.
>>>
>>>
>>> --
>>> For me personally I hacked kindof
>>>
>>> if type==UNSET then oldValue=new Object()
>>>
>>> into org.eclipse.emf.internal.cdo.object.CDONotificationBuilder to fool
>>> this rule, and .. I do get my updates.
>>> --
>>>
>>>
>>> I personally am too new to all this to dare to call this a bug, but when
>>> changing a reference from "anything non-null" to "null", or when
>>> unsetting a reference, oldValue should not be null.
>>>
>>> Let me know if this is by intention and how to safely work around in
>>> that case.
>>>
>>>
>>>
>>>
>>> On 23.01.2014 16:24, Jon Doe wrote:
>>>> Hello,
>>>>
>>>> having classes 'A' and 'B', with 'A.b' referencing/containing instances
>>>> of 'B', I stumbled over the following oddity when setting 'A.b' to
>>>> null:
>>>>
>>>> Other "local" views and transactions [from same CDOSession] do *not*
>>>> get
>>>> notified when 'A.b' is set to 'null', but they get notified when the
>>>> reference is changed to another instance of 'B'.
>>>>
>>>> In other clients ["remote"], changes are visible immediately --
>>>> regardless if 'A.b' is set to 'null' or another instance of 'B'.
>>>> (So the client which sets to 'null' does NOT reflect the changes, but
>>>> all other clients do so)
>>>>
>>>>
>>>> On the one hand I might have overseen something obvious to those who
>>>> know what they're doing, on the other hand I'm a bit confused why
>>>> things
>>>> work for "remote" clients as expectedly.
>>>>
>>>>
>>>> In short:
>>>> EMFObservables.observeValue((A) instance, (EReference) bReference);
>>>>
>>>> (Value)ChangeListeners fire for local modifications != 'null', and all
>>>> remote modifications regardless of value.
>>>>
>>>>
>>>> Now I feel lost -- thanks in advance.
>>>>
>>
>
|
|
| |
Goto Forum:
Current Time: Thu Apr 25 22:10:37 GMT 2024
Powered by FUDForum. Page generated in 0.03257 seconds
|