is executed one by one, it may cause previous constrainedPropertyBuilder overwrited by later constrainedPropertyBuilder.
The worst result of this issue is application go into a loop and never break. Will take some times to explain why go int a loop, in short, it was some HashMap code.
change to below code should fix the issue:
def validationClosure = validatableClass.constraints.clone()
When two thread run into this method at a same time, they all get closure
def validationClosure = validatableClass.constraints
The problem is two thread get same instance of closure. So when
validationClosure.setDelegate(constrainedPropertyBuilder)
is executed one by one, it may cause previous constrainedPropertyBuilder overwrited by later constrainedPropertyBuilder.
The worst result of this issue is application go into a loop and never break. Will take some times to explain why go int a loop, in short, it was some HashMap code.
change to below code should fix the issue: def validationClosure = validatableClass.constraints.clone()