Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] View update timing/concurrency
[CDO] View update timing/concurrency [message #1790463] Mon, 11 June 2018 12:14 Go to next message
Robert Schulk is currently offline Robert SchulkFriend
Messages: 144
Registered: July 2015
Senior Member
I was wondering what happens in this case:

* A class has two containment references x and y
* An object of this class is viewed by one client with a CDOView
* The object's references are both modified from another client by a CDOTransaction and a single commit.

Now let's say the viewing client exports the object to XML exactly during the update. Would it be possible that the exported file contains the changes for reference "x" but not for reference "y"?

Also, am I correct to assume that this is definitely prevented by using CDOView#syncExec?
Re: [CDO] View update timing/concurrency [message #1790474 is a reply to message #1790463] Mon, 11 June 2018 13:26 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Remote updates are incorporated into a local model by the invalidator thread of the view like so:

    synchronized (getViewMonitor())
    {
      lockView();

      try
      {
        doInvalidateSynced(invalidationData);
      }
      finally
      {
        unlockView();
      }
    }


If you don't want your model access be interrupted by the invalidator thread you should use CDOView.syncExec, which is implemented as follows:

  public void syncExec(Runnable runnable)
  {
    synchronized (getViewMonitor())
    {
      lockView();

      try
      {
        runnable.run();
      }
      finally
      {
        unlockView();
      }
    }
  }


Re: [CDO] View update timing/concurrency [message #1790480 is a reply to message #1790474] Mon, 11 June 2018 14:56 Go to previous message
Robert Schulk is currently offline Robert SchulkFriend
Messages: 144
Registered: July 2015
Senior Member
Sounds good, thanks!
I also wrote a small test with which I could -not- generate any inconsistent state.
Previous Topic:[EReference] How to change its referred EClass
Next Topic:Dynamic Enumeration-based Attributes
Goto Forum:
  


Current Time: Fri Apr 26 13:03:09 GMT 2024

Powered by FUDForum. Page generated in 0.03295 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top