Getting ConcurrentModificationException in ETL [message #1755479] |
Fri, 03 March 2017 16:16 |
Eclipse User |
|
|
|
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.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03145 seconds