Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Instances of EMF generated model thread safe ?
Instances of EMF generated model thread safe ? [message #530062] Wed, 28 April 2010 11:09 Go to next message
Kate Jackson is currently offline Kate JacksonFriend
Messages: 4
Registered: July 2009
Junior Member
Hi,

I just started with EMF so please correct me If I'm wrong.

EMF FAQ states that: "... The expectation is that a complete instance of the model (...) should only be accessed by one thread at a time, and that the synchronization should be provided by the application at a higher level. "

That's fine. Does the same applies to my scenario:
There are several instances of EMF generated model and each one of them is used by a separate thread:
ThreadA uses model instance 1
ThreadB uses model instance 2

There's a lot of static in generated code for XXXPackageImpl like:
public static XXX init() ...

Doesn't it make my scenario not thread safe too ?
I'm using EMF 2.1.1.

Thanks in advance,
Kate


this reality sucks
Re: Instances of EMF generated model thread safe ? [message #530088 is a reply to message #530062] Wed, 28 April 2010 12:44 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Kate,

Comments below.

Kate Jackson wrote:
> Hi,
>
> I just started with EMF so please correct me If I'm wrong.
>
> EMF FAQ states that: "... The expectation is that a complete instance
> of the model (...) should only be accessed by one thread at a time,
> and that the synchronization should be provided by the application at
> a higher level. "
>
> That's fine. Does the same applies to my scenario:
> There are several instances of EMF generated model and each one of
> them is used by a separate thread:
> ThreadA uses model instance 1
> ThreadB uses model instance 2
That's fine.
>
> There's a lot of static in generated code for XXXPackageImpl like:
> public static XXX init() ... Doesn't it make my scenario not thread
> safe too ?
> I'm using EMF 2.1.1.
You shouldn't call that method directly. It's called when you access
XyzPackage.eINSTANCE and the class loader generally ensures that class
initialization happens only once.
>
> Thanks in advance,
> Kate
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Temporarily add structural features to existent metamodel
Next Topic:PropertyView with variable number of entries for the same type
Goto Forum:
  


Current Time: Fri Apr 26 09:58:41 GMT 2024

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

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

Back to the top