Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Creating concrete model using threading
Creating concrete model using threading [message #677018] Tue, 07 June 2011 10:39 Go to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
Hi,

I have ecore model and i want to create 1000 XMI models using threading.
I am using
EOperation.Internal.InvocationDelegate.Factory.Registry.INSTANCE.put(oclDelegateURI,
new OCLInvocationDelegateFactory.Global());
EStructuralFeature.Internal.SettingDelegate.Factory.Registry.INSTANCE.put(oclDelegateURI, new OCLSettingDelegateFactory.Global());

When i create 1000 model in one thread then every thing works fine and it calculates every derived property but when i use multiple threads for less execution time it gives exception in delegation and says concurrent access.

Is the delegation being used is thread safe?

what is right procedure to make it work in multi threaded environment?.

Please help me
Re: Creating concrete model using threading [message #677129 is a reply to message #677018] Tue, 07 June 2011 16:18 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

We discussed this in an earlier thread and suspected that delegates
would not be threadsafe. I'm afraid you've just confirmed it.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=348606 raised.

You can probably avoid the problem by warming the delegates up in
single-threaded before launching the others. I would recommend creating
all Resource classes from a single thread too if the ResourceSet is shared.

You probably need to do an EPackage content traversal to perform a
practice eGet and eInvoke for everything with a delegate EAnnotation.

This could be a generally useful routine, that would be worth making
available to others, until it perhaps becomes redundant in Juno if the
bug is fixed. But even then it might be good to be able to warm up anyway.

Regards

Ed Willink




On 07/06/2011 11:39, forums-noreply@eclipse.org wrote:
> Hi,
>
> I have ecore model and i want to create 1000 XMI models using threading.
> I am using
> EOperation.Internal.InvocationDelegate.Factory.Registry.INSTANCE.put(oclDelegateURI,
> new OCLInvocationDelegateFactory.Global());
> EStructuralFeature.Internal.SettingDelegate.Factory.Registry.INSTANCE.put(oclDelegateURI,
> new OCLSettingDelegateFactory.Global());
>
> When i create 1000 model in one thread then every thing works fine and
> it calculates every derived property but when i use multiple threads
> for less execution time it gives exception in delegation and says
> concurrent access.
>
> Is the delegation being used is thread safe?
>
> what is right procedure to make it work in multi threaded environment?.
>
> Please help me
Re: Creating concrete model using threading [message #685860 is a reply to message #677129] Mon, 20 June 2011 12:29 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
Hi,

Thanks for your help.

Can you please ellaborate what do you mean by warming the delegates up?
I will be very thankful to you if you could explain with little example.

Warmest Regards,
Re: Creating concrete model using threading [message #686514 is a reply to message #677129] Wed, 22 June 2011 12:02 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
Hi,

Thanks for your help.

Can you please ellaborate what do you mean by warming the delegates up?
I will be very thankful to you if you could explain with little example.

Warmest Regards,

i am looking forward for your response
Re: Creating concrete model using threading [message #686639 is a reply to message #677129] Wed, 22 June 2011 16:26 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

In response to your disjoint queries, by warming up, I mean executing
all the code once so that all caches are populated. As I wrote

You probably need to do an EPackage content traversal to perform a
practice eGet and eInvoke for everything with a delegate EAnnotation.

Regards

Ed Willink


On 07/06/2011 17:18, Ed Willink wrote:
> Hi
>
> We discussed this in an earlier thread and suspected that delegates
> would not be threadsafe. I'm afraid you've just confirmed it.
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=348606 raised.
>
> You can probably avoid the problem by warming the delegates up in
> single-threaded before launching the others. I would recommend
> creating all Resource classes from a single thread too if the
> ResourceSet is shared.
>
> You probably need to do an EPackage content traversal to perform a
> practice eGet and eInvoke for everything with a delegate EAnnotation.
>
> This could be a generally useful routine, that would be worth making
> available to others, until it perhaps becomes redundant in Juno if the
> bug is fixed. But even then it might be good to be able to warm up
> anyway.
>
> Regards
>
> Ed Willink
>
>
>
>
> On 07/06/2011 11:39, forums-noreply@eclipse.org wrote:
>> Hi,
>>
>> I have ecore model and i want to create 1000 XMI models using threading.
>> I am using
>> EOperation.Internal.InvocationDelegate.Factory.Registry.INSTANCE.put(oclDelegateURI,
>> new OCLInvocationDelegateFactory.Global());
>> EStructuralFeature.Internal.SettingDelegate.Factory.Registry.INSTANCE.put(oclDelegateURI,
>> new OCLSettingDelegateFactory.Global());
>>
>> When i create 1000 model in one thread then every thing works fine
>> and it calculates every derived property but when i use multiple
>> threads for less execution time it gives exception in delegation and
>> says concurrent access.
>>
>> Is the delegation being used is thread safe?
>>
>> what is right procedure to make it work in multi threaded environment?.
>>
>> Please help me
>
Re: Creating concrete model using threading [message #687838 is a reply to message #686639] Thu, 23 June 2011 11:10 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
thanks alot!
Re: Creating concrete model using threading [message #692415 is a reply to message #687838] Mon, 04 July 2011 11:55 Go to previous messageGo to next message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
Hi,

As indigo is released recently and i have been trying to explore ImpactAnalyzer.
I have to create 1000 concrete model from one meta model i could create one concrete model and can try to modify it 1000 times and can try to calculte it. Is impact analyzer can help me in this situation? becuase all constructors of impact analyzer requires OCLExpression so that means i have to have one object of impact analyzer for each derived attribut... is this a good solution ?

How much help code generation can provide? if i create 1000 concrete models and generate code for each and then try to calculate?

Please help me

Warmest Regards,
Re: Creating concrete model using threading [message #693033 is a reply to message #692415] Tue, 05 July 2011 16:24 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

I don;'t really understand your questions.

The Impact Analyzer optimizes re-evaluation of OCL expressions after
model changes.

You appear to be creating 1000 different models and evaluating each
once; if that's what you mean by "calculte it". It is possible that if
you have 1 model that undergoes 999 mutations then you might use the
Impact Analyzer to update for each mutation, but thi would be a
meta-mutation; the impact analyzer optimizes changes in models rather
than changes in the expressions on the models. However viewedc from one
meta-level up these changes are just model changes after all. For a
large body of OCL this could be very beneficial, but I would expect to
need to do a little work to make it useful. Please report back if it works.

I'm not sure what you mean by code generation or what you would consider
to be help. genmodel will produce code to compile, cache and execute OCL
from source. Direct code generation of Java from OCL is planned for a
pre-Juno release. Either way generating code from 1000 models will give
1000 lots of code each of which will execute independently, unless you
make some effort to make them 999 mutations of one program rather than
1000 programs.

Regards

Ed Willink

On 04/07/2011 12:55, forums-noreply@eclipse.org wrote:
> Hi,
>
> As indigo is released recently and i have been trying to explore
> ImpactAnalyzer.
> I have to create 1000 concrete model from one meta model i could
> create one concrete model and can try to modify it 1000 times and can
> try to calculte it. Is impact analyzer can help me in this situation?
> becuase all constructors of impact analyzer requires OCLExpression so
> that means i have to have one object of impact analyzer for each
> derived attribut... is this a good solution ?
>
> How much help code generation can provide? if i create 1000 concrete
> models and generate code for each and then try to calculate?
>
> Please help me
>
> Warmest Regards,
Re: Creating concrete model using threading [message #693298 is a reply to message #693033] Wed, 06 July 2011 08:23 Go to previous message
ModelGeek Mising name is currently offline ModelGeek Mising nameFriend
Messages: 550
Registered: June 2011
Senior Member
Hi,

I meant to have 1 model having 999 mutations.
As i have been reading ImpactAnalyzer's java doc, All constructors requires OCL Expression which means i would need one object of Impact analyzer for every derived property.

So i could ask my first question like "Impact Analyzer is bound to one OCL Expression and for every derived property i need to have one impact analyzer object"?

My second question was that i want to generate code from my meta model at run time and then instanciate generated code 1000 times each instantiation represent one mutation of concrete model(means set the non derived properties and calculate derived ones).

Which methodology is better with respect to performance ImpactAnalyzer or Code generation?

Sorry if my questions are not well elaborated

Warmest Regards,
Previous Topic:Querying properties that are EFeatureMapEntry Objects
Next Topic:using OCL from java
Goto Forum:
  


Current Time: Sat Apr 20 01:57:07 GMT 2024

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

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

Back to the top