Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Concurrent reads after full resource traversal
Concurrent reads after full resource traversal [message #1796888] Sun, 21 October 2018 13:37 Go to next message
gwendal daniel is currently offline gwendal danielFriend
Messages: 7
Registered: January 2014
Junior Member
Hi,

I understood from different discussions on concurrency and EMF that accessing a model from multiple threads is not safe, and even read-only operations may produce unexpected behavior when resolving proxies and creating containment ELists.

I am wondering if it can be considered safe to concurrently access an EMF model that has been fully traversed in an initial phase? Doing so all the proxies should have been resolved, and all the containment ELists created.

I don't plan to perform any kind of modification on the model, I am just wondering if there is an "easy way" to concurrently access it, before considering advanced solutions such as CDO.

Note: I have looked on the forum for related posts, but I didn't find any with this specific question. Sorry if I have missed something and if this post is a dupicate.

Thanks
Re: Concurrent reads after full resource traversal [message #1796891 is a reply to message #1796888] Sun, 21 October 2018 14:57 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6389
Registered: July 2009
Senior Member
Hi

I have previously cautioned against multiple threads but identified that a warm up on one thread should make things work.

Basic EMF is fairly straightforward; an EcoreUtil.resolveAll may do. But if you use the package registry you may want to resolve all PackageDescriptors by a traversal, or just practice everything you do.

Greater dangers lie with UML caches and EMF setting delegates, particularly if use OCL.

You just need to ensure that everything is thoroughly warmed up on a single thread.

If you use Resources intermittently, you might be very unlucky and allow a garbage collection on one thread to outwit another. This is very unlikely because EMF has numerous reference cycles making accidental dereferencing hard even when intended, but nonetheless, best to keep solid references to avoid intermittencies.

Regards

Ed Willink


Re: Concurrent reads after full resource traversal [message #1796892 is a reply to message #1796891] Sun, 21 October 2018 15:08 Go to previous messageGo to next message
gwendal daniel is currently offline gwendal danielFriend
Messages: 7
Registered: January 2014
Junior Member
Hi Ed,

Thanks a lot! I'll try to warmup everything in a single thread, and see if there is any issue. I don't plan to use UML caches or EMF setting delegates for now, but I keep in mind they may be an issue.

Regards,

Gwendal
Re: Concurrent reads after full resource traversal [message #1796893 is a reply to message #1796892] Sun, 21 October 2018 15:40 Go to previous message
Jon Passki is currently offline Jon PasskiFriend
Messages: 31
Registered: November 2015
Member

If anything adapts the model and processes notifications (e.g. touch), this could be a problem depending upon the Notification implementation: NotificationImpl.get{New,Old}Value, NotificationImpl.{add,merge}, and NotificationImpl.is{Touch,Reset} aren't thread safe.
Previous Topic:ECore model evolution and versioning
Next Topic:Separate workflow project for emf code generation
Goto Forum:
  


Current Time: Tue Jun 18 12:52:59 GMT 2019

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

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

Back to the top