Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] react on remote model changes(IListener (CDOView) notifyEvent consumption)
[CDO] react on remote model changes [message #930417] Tue, 02 October 2012 05:47 Go to next message
Christian Stellwag is currently offline Christian Stellwag
Messages: 48
Registered: July 2009
Location: Munich
Member
Hello Forum Readers,

I need some clarification on this topic.
Using CDO version 4.0.99 in a client/server application (RCP) we need mechanism to update clients when underlying data was changed (usually by different user).

Our current implementation registers as IListener on the CDOView and receives
notifyEvent(IEvent) change notifications.

As I understood from reading forum entries and docu this is one out of 3 possibilities to get informed (CDOSession.addListener and object.eAdapter().add(yourAdapter) being the other 2).

From Debugging the application I learned that notifyEvent is called twice,
first time with IEvent being CDOViewInvalidationEvent carrying information about what has changed (getDirtyObjects() and getDetachedObjects()).
Second time with CDOViewAdaptersNotifiedEvent.

Since I somehow rely on both events in this sequence my questions are:
- Is there a guarantee that both event notifications are submitted?
- in exactly this order?

I didn't find any exact documentation about this. Does it exist? Where?

Would you rather recommend to only consume CDOViewInvalidationEvent and ignore CDOViewAdaptersNotifiedEvent?

Thanx in advance,
Chris
Re: [CDO] react on remote model changes [message #930439 is a reply to message #930417] Tue, 02 October 2012 06:07 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5446
Registered: July 2009
Senior Member
Am 02.10.2012 11:47, schrieb Christian Stellwag:
> Hello Forum Readers,
>
> I need some clarification on this topic.
> Using CDO version 4.0.99 in a client/server application (RCP) we need mechanism to update clients when underlying data
> was changed (usually by different user).
What does 4.0.99 mean?

> Our current implementation registers as IListener on the CDOView and receives
> notifyEvent(IEvent) change notifications.
>
> As I understood from reading forum entries and docu this is one out of 3 possibilities to get informed
> (CDOSession.addListener and object.eAdapter().add(yourAdapter) being the other 2).
Yes, actually there's an old fourth way: CDOInvalidationNotification from pre-CDODeltaNotification times.

> From Debugging the application I learned that notifyEvent is called twice,
> first time with IEvent being CDOViewInvalidationEvent carrying information about what has changed (getDirtyObjects()
> and getDetachedObjects()).
> Second time with CDOViewAdaptersNotifiedEvent.
>
> Since I somehow rely on both events in this sequence my questions are:
> - Is there a guarantee that both event notifications are submitted?
> - in exactly this order?
Yes and yes. Have a look at CDOViewImpl.doInvalidate() where the events/notifications are emitted in the following order:

sendInvalidationNotifications();
fireInvalidationEvent();

if (!deltas.isEmpty() || !detachedObjects.isEmpty())
{
sendDeltaNotifications(deltas, detachedObjects, oldRevisions);
}

fireAdaptersNotifiedEvent(lastUpdateTime);


> I didn't find any exact documentation about this. Does it exist? Where?
The docs are incomplete? You're kidding! :P

> Would you rather recommend to only consume CDOViewInvalidationEvent and ignore CDOViewAdaptersNotifiedEvent?
No. It all depends on what you want to achieve.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] react on remote model changes [message #930460 is a reply to message #930439] Tue, 02 October 2012 06:37 Go to previous message
Christian Stellwag is currently offline Christian Stellwag
Messages: 48
Registered: July 2009
Location: Munich
Member

Hi Eike,

Thank you very much for your quick answer.
You provided all necessary information for me.

Cheers, Chris
Previous Topic:[CDO] NPE when requesting an EObject from a different view that is TRANSIENT
Next Topic:[CDO] Querying HREFs in the repository
Goto Forum:
  


Current Time: Sun Apr 20 12:21:42 EDT 2014

Powered by FUDForum. Page generated in 0.01680 seconds