Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMFT] Reloading resources in a transactional editing context
[EMFT] Reloading resources in a transactional editing context [message #964723] Tue, 30 October 2012 18:52 Go to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 676
Registered: July 2009
Senior Member
Hi,

I've just seen something like this:

TransactionalEditingDomain domain;
domain.runExclusive(new Runnable(){
domain.getResourceSet().getResource(someURI).unload();
domain.getResourceSet().getResource(someURI).load(...);
});

Had I just seen this snippet, I'd say this will throw a transaction
exception, since it requires a write context. But I've seen it in
production code and it does not throw an Exception. So even if this
"runs", is it broken? Should I run such a reload not better in a write
context?

Thanks for comments,
Felix
Re: [EMFT] Reloading resources in a transactional editing context [message #965152 is a reply to message #964723] Wed, 31 October 2012 02:55 Go to previous message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 847
Registered: July 2009
Senior Member
Hi, Felix,

The TransactionalEditingDomain goes out of its way to distinguish
between changes to objects that modify the "actual semantic content"
(you might call them "abstract changes") and changes that modify the
internal state of objects (call them "concrete changes").

When you unload a resource, a whole bunch of objects become proxies,
but they aren't edited. If you read the model again and re-resolve
those proxies, you get exactly the same data back (but maybe different
Java identities).

Loading a resource, saving it, and unloading it are all read-compatible
operations because they don't actually change the model data.

I hope that made sense. It's late and my eyes are tired.

cW


On 2012-10-30 18:52:34 +0000, Felix Dorner said:

> Hi,
>
> I've just seen something like this:
>
> TransactionalEditingDomain domain;
> domain.runExclusive(new Runnable(){
> domain.getResourceSet().getResource(someURI).unload();
> domain.getResourceSet().getResource(someURI).load(...);
> });
>
> Had I just seen this snippet, I'd say this will throw a transaction
> exception, since it requires a write context. But I've seen it in
> production code and it does not throw an Exception. So even if this
> "runs", is it broken? Should I run such a reload not better in a write
> context?
>
> Thanks for comments,
> Felix
Previous Topic:[CDO] Offline Branching
Next Topic:[CDO] Repository recovery fails after crash with stanalone CDO sever with postgresql
Goto Forum:
  


Current Time: Sun Dec 21 07:01:04 GMT 2014

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

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