[cdi-dev] It seems we missed a point in CDIProvider enhancement

Mark Struberg struberg at yahoo.de
Thu May 14 03:12:48 EDT 2015


I still don’t get it what running multiple CDI container on the SAME ClassLoader/Thread should be for?
What’s the use case? 

LieGrue,
strub


> Am 14.05.2015 um 08:11 schrieb Martin Kouba <mkouba at redhat.com>:
> 
> Hi Antoine,
> 
> Weld SE 3.0.0.Alpha8 [1] (which allows to start multiple independent 
> Weld instances) has a special CDIProvider implementation [2]:
> 
> * if there's exactly one container running, return this container
> * if there are multiple containers running, log an INFO message and 
> attempt to identify the container by the calling class:
> ** if there is only one container aware of the class, return this container
> ** otherwise return the first container initialized
> 
> Martin
> 
> [1]
> http://weld.cdi-spec.org/news/2015/04/21/weld-300Alpha8/
> 
> [2]
> https://github.com/weld/core/blob/master/environments/se/core/src/main/java/org/jboss/weld/environment/se/WeldSEProvider.java
> 
> 
> Dne 13.5.2015 v 19:08 Antoine Sabot-Durand napsal(a):
>> Hi all,
>> 
>> While cleaning Javadoc in CDIProvider, I realized that getCDI() method description is not compatible with the multiple container initialization we allowed in the API.
>> 
>> While running in Java EE getCDI() retuns the current container which is fine since there’s only one, but what do we expect from it when running in SE?
>> 
>> I thought of 2 simple solutions for EDR1:
>> 
>> 1) make getCDI() return the last CDI object initialized by the CDIProvider
>> 2) Forbid getCDI() in SE
>> 
>> Of course there’s always the solution of moving the code outside CDIProvider, but it’s less simple…
>> 
>> Wdyt,
>> 
>> Antoine
>> 
>> 
>> 
>> _______________________________________________
>> cdi-dev mailing list
>> cdi-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/cdi-dev
>> 
>> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.
>> 
> 
> -- 
> Martin Kouba
> Software Engineer
> Red Hat, Czech Republic
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
> 
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.




More information about the cdi-dev mailing list