Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Getting ConcurrentModificationException in ETL
Getting ConcurrentModificationException in ETL [message #1755479] Fri, 03 March 2017 16:16 Go to next message
Bugra M. Yildiz is currently offline Bugra M. YildizFriend
Messages: 106
Registered: July 2014
Senior Member
Hello,

I have the following metamodel:

A (EClass) contains 2 or more B (EClass) elements.

B elements are in a double-linked list structure, it has next and prev references.


I have a model transformation with only one input model, which is InOutModel. My transformation rules (They just insert a new B instance before another one that satisfies the guard condition) are the following two (I tried to simplify the real one here):

@lazy
@greedy
rule abstract_TransformationRule transform
	thisB:InOutModel!B to null
{
	
	guard: thisB fits criterion 0.
	
	
	"abstract_TransformationRule.".println();
}

@greedy
rule InsertBeforeTransformationRule1  transform
	thisB:InOutModel!B to 
		//null
		//newB:InOutModel!B
	extends abstract_TransformationRule
{
	guard:  thisB fits criterion 1.
}


If I use null as target of the second rule (commented out for now), everything seems fine. If I use newB as target, then I get a ConcurrentModificationException.

I guess the reason is, when the rule is executing, Epsilon iterates over the list of Bs contained in A. However, the rule also adds additional elements to the same list.

I wonder how such a transformation should be written without getting ConcurrentModificationException.

Re: Getting ConcurrentModificationException in ETL [message #1755480 is a reply to message #1755479] Fri, 03 March 2017 16:19 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1520
Registered: July 2009
Location: York, UK
Senior Member

Hi Bugra,

Your diagnosis is correct. Is there any chance that the Epsilon Pattern Language (see Chapter 11 of the Epsilon book) is a more suitable fit for this transformation?

Cheers,
Dimitris
Re: Getting ConcurrentModificationException in ETL [message #1755490 is a reply to message #1755480] Fri, 03 March 2017 17:37 Go to previous messageGo to next message
Bugra M. Yildiz is currently offline Bugra M. YildizFriend
Messages: 106
Registered: July 2014
Senior Member
Thanks Dimitris, that was a very fast response Smile! I have checked EPL and I wonder if EPL patterns can extend each other? If they can, could you inform me about syntax and semantics of it?

Re: Getting ConcurrentModificationException in ETL [message #1755510 is a reply to message #1755490] Sat, 04 March 2017 08:50 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1520
Registered: July 2009
Location: York, UK
Senior Member

Hi Bugra,

Currently, patterns cannot extend each other but if you could briefly describe a use case where this would be beneficial, we can consider adding this feature.

Cheers,
Dimitris
Previous Topic:adding new element F to Containmentreference
Next Topic:Link Annotation style doesnt work
Goto Forum:
  


Current Time: Sun Apr 22 01:31:33 GMT 2018

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

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