Could we not adjust such that after the execution plan is created, prepare all the class realms required by the plan and once constructed left immutable during the actual execution of the plan. I can't quite remember but I'm not sure why we need multiple threads constructing realms with the execution plan in hand. Prepare the realms according to the plan, make them immutable and use them throughout the session.
On Jul 26, 2012, at 8:44 AM, Kristian Rosenvold wrote: > There is a race condition in parallel builds that occurs related to > this piece of code: > > http://maven.apache.org/ref/3.0.4/maven-core/xref/org/apache/maven/classrealm/DefaultClassRealmManager.html#75 > > The thing is, for some reason, there's a loop that retries the class > realm generation with a random suffix if the class realm already > exists. In a parallel run, there will be multiple threads requesting > the same realm-id, which semantically should map to the same instance > of the class realm. > > (Most plugins do not really mind if there's a duplicate class realm > every now and then, but some take it very seriously ;) > > I'm tempted to change the semantics of the "newRealm" method to > "getOrCreateRealm", since that seems to be the correct semantics no > matter what. I've tried tracking the origin of the while loop, and it > seems to be very old. Anyone have any idea of what purpose it served ? > > Kristian > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > Thanks, Jason ---------------------------------------------------------- Jason van Zyl Founder & CTO, Sonatype Founder, Apache Maven http://twitter.com/jvanzyl --------------------------------------------------------- Simplex sigillum veri. (Simplicity is the seal of truth.)
