|
Re: [EMFT] Reloading resources in a transactional editing context [message #965152 is a reply to message #964723] |
Wed, 31 October 2012 02:55 |
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03983 seconds