Instances of EMF generated model thread safe ? [message #530062] |
Wed, 28 April 2010 11:09 |
Kate Jackson 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 |
Ed Merks 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/
|
|
|
Powered by
FUDForum. Page generated in 0.03208 seconds