In that case we may just want to differentiate because the parallel execution 
use case is not one that happens inside the IDE. In the case of CLI execution 
it can all be handled up front as additional realm construction beyond the CLI 
execution isn't going to happen. In an IDE or shell wouldn't a map of realms 
keyed by GAV suffice? Sync on write everyone is free to read? 

On Jul 26, 2012, at 12:06 PM, Igor Fedorenko wrote:

> This is required in m2e where multiple versions of the same plugin can
> coexist for long time in the same container.
> 
> --
> Regards,
> Igor
> 
> On 12-07-26 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]
>> 
> 
> ---------------------------------------------------------------------
> 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
---------------------------------------------------------

The modern conservative is engaged in one of man's oldest exercises in moral 
philosophy; that is, 
the search for a superior moral justification for selfishness.

 -- John Kenneth Galbraith





Reply via email to