<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi John,</div><div class=""><br class=""></div><div class="">I think it could be a good idea to write down all of these to have a more stable doc for discussion. You should update the google doc with the result of this discussion.</div><div class=""><br class=""></div><div class="">I agree with the following points in this thread :</div><div class=""><br class=""></div><div class="">- Minimize the number of new Class / Interface. CDI and CDIProvider usage is still not very clear for end user so we should add the strict minimum and try to enhance existing API / SPI when possible</div><div class="">- Be able to bootstrap CDI without returning BeanManager (env if the API give possibility to access it if needed). End user don’t need that : CDI app can start with an observer for instance</div><div class=""><br class=""></div><div class="">Something not dealt with but that we should keep in mind :</div><div class="">- Providing a Java SE solution that could be easily used for a servlet bootstrap of CDI. I don’t know if we’ll standardize this but we definitely should keep this use case in mind</div><div class=""><br class=""></div><div class="">and my bonus, it’s out of scope but I didn’t see anytime there that prevent this nice to have:</div><div class="">- support the possibility to boot multiple BeanManager in Java SE.</div><div class=""><br class=""></div><div class="">Antoine</div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">Le 1 mars 2015 à 15:13, John D. Ament &lt;<a href="mailto:john.d.ament@gmail.com" class="">john.d.ament@gmail.com</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">So, I think I've gathered enough feedback at this point, and seen some of the API changes.&nbsp; I'll hopefully be including some doc changes this week, but one question - do we want to start the SE specific stuff as its own asciidoc file?<div class=""><br class=""></div><div class="">Changes made:</div><div class=""><br class=""></div><div class="">- Changed return value to CDI&lt;Object&gt; to provide better capability out of the box.</div><div class="">- Added AutoCloseable to CDIContainer, provided default implementation of calling shutdown.</div><div class="">- Added synchronization support to the method body that retrieves the singleton instance (BTW, I'm not sure if this is even useful TBH as each impl, including the RI, needs to provide this class in its own format).</div><div class="">- Made the params map typed to &lt;String,Object&gt;</div><div class=""><br class=""></div><div class="">@Romain Your case isn't really supportable yet, until we have static injection support.&nbsp; You'd still have to have a managed version of Runner to work against.</div><div class=""><br class=""></div><div class="">John<br class=""><br class=""><div class="gmail_quote">On Sat, Feb 28, 2015 at 4:11 PM Romain Manni-Bucau &lt;<a href="mailto:rmannibucau@gmail.com" class="">rmannibucau@gmail.com</a>&gt; wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr" class="">Yes but not the way to get an instance. Even Unmanaged does it.</p><p dir="ltr" class="">What can be awesome is to have static inject for it:</p><p dir="ltr" class="">public class Runner {</p><p dir="ltr" class="">@Inject<br class="">
private static MyMain main;</p><p dir="ltr" class="">public static void main(String[] arg) {<br class="">
&nbsp;&nbsp;&nbsp; try (CDIContainer c = CDIContainer.newContainer()) {<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; main.doWork();<br class="">
&nbsp;&nbsp;&nbsp; }<br class="">
}</p><p dir="ltr" class="">}</p><p dir="ltr" class="">And not a single additional line :).<br class="">
</p>
<div class="gmail_quote">Le 28 févr. 2015 19:05, "John D. Ament" &lt;<a href="mailto:john.d.ament@gmail.com" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&amp;tf=1&amp;to=john.d.ament@gmail.com&amp;cc=&amp;bcc=&amp;su=&amp;body=','_blank');return false;" class="">john.d.ament@gmail.com</a>&gt; a écrit :</div><div class="gmail_quote"><br type="attribution" class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Maybe I'm misreading, but I don't see us adding another API to do the same thing here - we're introducing new functionality.<div class=""><br class=""></div><div class="">CDIContainer/Loader on startup/shutdown of the application</div><div class=""><br class=""></div><div class="">CDI for runtime usage within the application to interact with the container.</div><div class=""><br class=""></div><div class="">John<br class=""><br class=""><div class="gmail_quote">On Fri, Feb 27, 2015 at 3:40 AM Romain Manni-Bucau &lt;<a href="mailto:rmannibucau@gmail.com" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&amp;tf=1&amp;to=rmannibucau@gmail.com&amp;cc=&amp;bcc=&amp;su=&amp;body=','_blank');return false;" class="">rmannibucau@gmail.com</a>&gt; wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">sure I fully agree excepted I think introducing yet another API to do<br class="">
the same thing is not good so super tempting to skip it and wait for<br class="">
feedbacks rather than introducing it eagerly.<br class="">
<br class="">
<br class="">
Romain Manni-Bucau<br class="">
@rmannibucau<br class="">
<a href="http://www.tomitribe.com/" target="_blank" class="">http://www.tomitribe.com</a><br class="">
<a href="http://rmannibucau.wordpress.com/" target="_blank" class="">http://rmannibucau.wordpress.<u class=""></u>com</a><br class="">
<a href="https://github.com/rmannibucau" target="_blank" class="">https://github.com/rmannibucau</a><br class="">
<br class="">
<br class="">
2015-02-27 8:05 GMT+01:00 Jozef Hartinger &lt;<a href="mailto:jharting@redhat.com" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&amp;tf=1&amp;to=jharting@redhat.com&amp;cc=&amp;bcc=&amp;su=&amp;body=','_blank');return false;" class="">jharting@redhat.com</a>&gt;:<br class="">
&gt; My point is that from the application perspective, the user obtains one<br class="">
&gt; container handle for eventual shutdown (CDIContainer) and then looks up a<br class="">
&gt; different container handle (CDI) that they can use for real work (lookup /<br class="">
&gt; event dispatch / etc.) It would be cleaner if the container gave away a<br class="">
&gt; single handle that can do all of that.<br class="">
&gt;<br class="">
&gt;<br class="">
&gt; On 02/26/2015 05:42 PM, Romain Manni-Bucau wrote:<br class="">
&gt;<br class="">
&gt; Not sure I get how a CDI instance can help.<br class="">
&gt;<br class="">
&gt; But container.getBeanManager() sounds nice is not a shortcut for<br class="">
&gt; CDI.current().getBm() otherwise it looks like duplication to me.<br class="">
&gt;<br class="">
&gt; Can we make container not contextual - dont think so? If so it makes sense<br class="">
&gt; otherwise I fear it doesnt add much.<br class="">
&gt;<br class="">
&gt; Le 26 févr. 2015 16:19, "Jozef Hartinger" &lt;<a href="mailto:jharting@redhat.com" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&amp;tf=1&amp;to=jharting@redhat.com&amp;cc=&amp;bcc=&amp;su=&amp;body=','_blank');return false;" class="">jharting@redhat.com</a>&gt; a écrit :<br class="">
&gt;&gt;<br class="">
&gt;&gt; I like the initialize + close() combination and the try-with-resources<br class="">
&gt;&gt; usage.<br class="">
&gt;&gt; What looks weird to me is that at line one you obtain a container handle:<br class="">
&gt;&gt;<br class="">
&gt;&gt; try (CDIContainer container = CDIContainer.newCDIContai...<br class="">
&gt;&gt; CDI.current().getBeanManager() ...<br class="">
&gt;&gt;<br class="">
&gt;&gt; and then at line two you call a static method to perform a container<br class="">
&gt;&gt; lookup :-/<br class="">
&gt;&gt;<br class="">
&gt;&gt; An API that allows you to use the container handle you already got is way<br class="">
&gt;&gt; better IMO, e.g.:<br class="">
&gt;&gt;<br class="">
&gt;&gt; try (CDIContainer container = CDIContainer.newCDIContai...<br class="">
&gt;&gt; container.getBeanManager()<br class="">
&gt;&gt;<br class="">
&gt;&gt; If CDIContainer.newCDIContainer() returns an CDI instance or its subclass,<br class="">
&gt;&gt; we get this easily.<br class="">
&gt;&gt;<br class="">
&gt;&gt; On 02/26/2015 08:58 AM, Romain Manni-Bucau wrote:<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; Hi guys<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; why note keeping it simple?<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; try (CDIContainer container = CDIContainer.newCDIContainer(/<u class=""></u>* optional<br class="">
&gt;&gt;&gt; map to configure vendor features */)) {<br class="">
&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;CDI.current().getBeanManager()<u class=""></u>....<br class="">
&gt;&gt;&gt; }<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; Not sure the point having initialize() + having shutdown = close<br class="">
&gt;&gt;&gt; really makes the API more fluent and modern IMO.<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; Also to be fully SE I guess provider() method would be needed even if<br class="">
&gt;&gt;&gt; optional (SPI usage by default):<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; try (CDIContainer container =<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; CDIContainer.provider("org.<u class=""></u>jboss.weld.<u class=""></u>WeldCdiContainerProvider").<u class=""></u>newCDIContainer())<br class="">
&gt;&gt;&gt; {<br class="">
&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;CDI.current().getBeanManager()<u class=""></u>....<br class="">
&gt;&gt;&gt; }<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; Finally I think having a kind of getInstance shortcut could be a plus for<br class="">
&gt;&gt;&gt; SE:<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; try (CDIContainer container = CDIContainer.newCDIContainer()<u class=""></u>) {<br class="">
&gt;&gt;&gt;&nbsp; &nbsp; &nbsp; &nbsp;container.newInstance(<u class=""></u>MyAppRunner.class /* optional qualifiers */<br class="">
&gt;&gt;&gt; ).run(args);<br class="">
&gt;&gt;&gt; }<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; Using container to get an instance would create the instance and bind<br class="">
&gt;&gt;&gt; it to the container lifecycle (mainly for predestroy) avoiding this<br class="">
&gt;&gt;&gt; boilerplate code in all main which will surely only be used to launch<br class="">
&gt;&gt;&gt; a soft.<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; wdyt?<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; Romain Manni-Bucau<br class="">
&gt;&gt;&gt; @rmannibucau<br class="">
&gt;&gt;&gt; <a href="http://www.tomitribe.com/" target="_blank" class="">http://www.tomitribe.com</a><br class="">
&gt;&gt;&gt; <a href="http://rmannibucau.wordpress.com/" target="_blank" class="">http://rmannibucau.wordpress.<u class=""></u>com</a><br class="">
&gt;&gt;&gt; <a href="https://github.com/rmannibucau" target="_blank" class="">https://github.com/rmannibucau</a><br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;<br class="">
&gt;&gt;&gt; 2015-02-26 8:32 GMT+01:00 Jozef Hartinger &lt;<a href="mailto:jharting@redhat.com" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&amp;tf=1&amp;to=jharting@redhat.com&amp;cc=&amp;bcc=&amp;su=&amp;body=','_blank');return false;" class="">jharting@redhat.com</a>&gt;:<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; Comments inline<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; On 02/25/2015 05:53 PM, John D. Ament wrote:<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; Sorry Jozef, your email fell into the pits of google inbox's "smart<br class="">
&gt;&gt;&gt;&gt; sorting"<br class="">
&gt;&gt;&gt;&gt; features.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; On Thu, Feb 12, 2015 at 3:18 AM Jozef Hartinger &lt;<a href="mailto:jharting@redhat.com" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&amp;tf=1&amp;to=jharting@redhat.com&amp;cc=&amp;bcc=&amp;su=&amp;body=','_blank');return false;" class="">jharting@redhat.com</a>&gt;<br class="">
&gt;&gt;&gt;&gt; wrote:<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; Hi John, comments inline:<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; On 02/11/2015 06:02 PM, John D. Ament wrote:<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; Jozef,<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; Most of what you see there is taken from the original doc, since<br class="">
&gt;&gt;&gt;&gt;&gt; everyone<br class="">
&gt;&gt;&gt;&gt;&gt; seemed to be in agreement.&nbsp; I think the map is just a safeguard in case<br class="">
&gt;&gt;&gt;&gt;&gt; of<br class="">
&gt;&gt;&gt;&gt;&gt; additional boot options available in some implementations (e.g. I think<br class="">
&gt;&gt;&gt;&gt;&gt; OWB/OpenEJB have some options.. currently OpenEJB supports an embedded<br class="">
&gt;&gt;&gt;&gt;&gt; CDI<br class="">
&gt;&gt;&gt;&gt;&gt; boot mode).<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; No, I am fine with the map. What I am questioning is the type of the<br class="">
&gt;&gt;&gt;&gt;&gt; map.<br class="">
&gt;&gt;&gt;&gt;&gt; Usually, data structures with a similar purpose use Strings as their<br class="">
&gt;&gt;&gt;&gt;&gt; keys.<br class="">
&gt;&gt;&gt;&gt;&gt; This applies to ServletContext attributes, InvocationContext data,<br class="">
&gt;&gt;&gt;&gt;&gt; Servlet<br class="">
&gt;&gt;&gt;&gt;&gt; request/session attributes and others. I am therefore wondering whether<br class="">
&gt;&gt;&gt;&gt;&gt; there is a usecase for the proposed unbound key signature or not.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; I think that's more of a placeholder, I was assuming it would be<br class="">
&gt;&gt;&gt;&gt; Map&lt;String,Object&gt; once we clarify everything.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; We spoke a few times about BeanManager vs CDI.&nbsp; BeanManager was<br class="">
&gt;&gt;&gt;&gt;&gt; preferable<br class="">
&gt;&gt;&gt;&gt;&gt; since there's no easy way to get the the instance, CDI is easier to get<br class="">
&gt;&gt;&gt;&gt;&gt; and<br class="">
&gt;&gt;&gt;&gt;&gt; more aligned with how you would get it.&nbsp; Usually people expect the<br class="">
&gt;&gt;&gt;&gt;&gt; BeanManager to be injected or available via JNDI, neither would be the<br class="">
&gt;&gt;&gt;&gt;&gt; case<br class="">
&gt;&gt;&gt;&gt;&gt; here.<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; If CDI 2.0 targets Java SE then this container initialization API will<br class="">
&gt;&gt;&gt;&gt;&gt; become something that ordinary application developers use to start/stop<br class="">
&gt;&gt;&gt;&gt;&gt; CDI<br class="">
&gt;&gt;&gt;&gt;&gt; in their applications. It therefore cannot be considered an SPI but<br class="">
&gt;&gt;&gt;&gt;&gt; instead<br class="">
&gt;&gt;&gt;&gt;&gt; should be something easy to use. On the other hand, BeanManager is<br class="">
&gt;&gt;&gt;&gt;&gt; definitely an SPI. It is used in extension, frameworks and generally<br class="">
&gt;&gt;&gt;&gt;&gt; for<br class="">
&gt;&gt;&gt;&gt;&gt; integration. Not much by applications directly. Therefore, I don't see<br class="">
&gt;&gt;&gt;&gt;&gt; how<br class="">
&gt;&gt;&gt;&gt;&gt; the container bootstrap API and BeanManager fit together. IMO the<br class="">
&gt;&gt;&gt;&gt;&gt; bootstrap<br class="">
&gt;&gt;&gt;&gt;&gt; API should expose something that makes common tasks (obtaining a<br class="">
&gt;&gt;&gt;&gt;&gt; contextual<br class="">
&gt;&gt;&gt;&gt;&gt; reference and firing and event) easy, which the CDI class does.<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; Plus do not forget that BeanManager can be obtained easily using<br class="">
&gt;&gt;&gt;&gt;&gt; CDI.getBeanManager().<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; I'm not disagreeing.&nbsp; There's a few things I'd consider:<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; - Is this mostly for new apps or existing?&nbsp; If existing, it's probably<br class="">
&gt;&gt;&gt;&gt; using<br class="">
&gt;&gt;&gt;&gt; some internal API, if new it can use whatever API we give.<br class="">
&gt;&gt;&gt;&gt; - I don't want to return void, we should give some kind of reference<br class="">
&gt;&gt;&gt;&gt; into<br class="">
&gt;&gt;&gt;&gt; the container when we're done booting.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; Agreed, we should not be returning void.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; - CDI is a one step retrievable reference, where as BeanManager is a two<br class="">
&gt;&gt;&gt;&gt; step reference.&nbsp; With that said, BeanManager makes more sense to return<br class="">
&gt;&gt;&gt;&gt; here.&nbsp; Another thought could be we invent some new class that has both,<br class="">
&gt;&gt;&gt;&gt; but<br class="">
&gt;&gt;&gt;&gt; that's really redundant.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; Why do you think BeanManager makes more sense here? Especially given the<br class="">
&gt;&gt;&gt;&gt; assumption that application code is going to call this init/shutdown<br class="">
&gt;&gt;&gt;&gt; API, I<br class="">
&gt;&gt;&gt;&gt; don't see BeanManager as making more sense.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; Yes, this is the container start API.&nbsp; Sounds like you have some good<br class="">
&gt;&gt;&gt;&gt;&gt; ideas for things like XML configuration or programmatic configuration,<br class="">
&gt;&gt;&gt;&gt;&gt; both<br class="">
&gt;&gt;&gt;&gt;&gt; of which are being tracked under separate tickets.&nbsp; One idea might be<br class="">
&gt;&gt;&gt;&gt;&gt; for an<br class="">
&gt;&gt;&gt;&gt;&gt; optional param in the map to control packages to scan/ignore, in that<br class="">
&gt;&gt;&gt;&gt;&gt; map.<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; I am wondering whether this configuration should be something optional<br class="">
&gt;&gt;&gt;&gt;&gt; built on top of the bootstrap API or whether we should consider making<br class="">
&gt;&gt;&gt;&gt;&gt; it<br class="">
&gt;&gt;&gt;&gt;&gt; mandatory. Either way, we cannot add the bootstrap API to the spec<br class="">
&gt;&gt;&gt;&gt;&gt; without<br class="">
&gt;&gt;&gt;&gt;&gt; explicitly defining how it behaves. My implicit assumption of the<br class="">
&gt;&gt;&gt;&gt;&gt; proposal<br class="">
&gt;&gt;&gt;&gt;&gt; is that the container is supposed to scan the entire classpath for<br class="">
&gt;&gt;&gt;&gt;&gt; explicit<br class="">
&gt;&gt;&gt;&gt;&gt; or implicit bean archives (including e.g. rt.jar), discover beans, fire<br class="">
&gt;&gt;&gt;&gt;&gt; extensions, etc. This worries me as this default behavior is far from<br class="">
&gt;&gt;&gt;&gt;&gt; being<br class="">
&gt;&gt;&gt;&gt;&gt; lightweight, which CDI for Java SE initially aimed to be.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; Yes, the spec must be updated to reflect the behavior of SE mode.&nbsp; I<br class="">
&gt;&gt;&gt;&gt; plan to<br class="">
&gt;&gt;&gt;&gt; get that completely into the google doc before opening any spec changes<br class="">
&gt;&gt;&gt;&gt; in a<br class="">
&gt;&gt;&gt;&gt; PR.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; We didn't want to over load the CDI interface.&nbsp; It already does a lot.<br class="">
&gt;&gt;&gt;&gt;&gt; This is really SPI code, CDI even though it's in the spi package is<br class="">
&gt;&gt;&gt;&gt;&gt; used in<br class="">
&gt;&gt;&gt;&gt;&gt; a lot of application code.<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; I would personally prefer to have it all in one place. Having<br class="">
&gt;&gt;&gt;&gt;&gt; CDIContainer, CDIContainerLoader, CDI and CDIProvider makes it more<br class="">
&gt;&gt;&gt;&gt;&gt; difficult to know when to use what.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; The problem is that most CDI (the interface) operations are against a<br class="">
&gt;&gt;&gt;&gt; running container.&nbsp; I think we spoke about leveraging CDIProvider at one<br class="">
&gt;&gt;&gt;&gt; point (in fact, I mistakenly called CDIContainer CDIProvider not even<br class="">
&gt;&gt;&gt;&gt; realizing it was there).&nbsp; I doubt that most app developers use it<br class="">
&gt;&gt;&gt;&gt; currently,<br class="">
&gt;&gt;&gt;&gt; there's not even a way to get a reference to it that I'm aware of.&nbsp; It's<br class="">
&gt;&gt;&gt;&gt; used by the implementor only.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; I don't think there's a conflict. CDI class would still only provide<br class="">
&gt;&gt;&gt;&gt; methods<br class="">
&gt;&gt;&gt;&gt; to be run against a running container. The difference is that there<br class="">
&gt;&gt;&gt;&gt; would be<br class="">
&gt;&gt;&gt;&gt; additional static methods to get this running container (CDI class) to<br class="">
&gt;&gt;&gt;&gt; you<br class="">
&gt;&gt;&gt;&gt; by starting the container.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; Either way, I agree that reusing CDIProvider is a must. There is no<br class="">
&gt;&gt;&gt;&gt; reason<br class="">
&gt;&gt;&gt;&gt; to define a new class for the same purpose.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; I expect that my changes in the CDI spec around this will state, along<br class="">
&gt;&gt;&gt;&gt; the<br class="">
&gt;&gt;&gt;&gt; lines of:<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; To retrieve a CDIContainer to launch, do this:<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; CDIContainer container = CDIContainerLocator.<u class=""></u>getCDIContainer();<br class="">
&gt;&gt;&gt;&gt; container.initialize();<br class="">
&gt;&gt;&gt;&gt; ... do work<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; Once you want to shutdown the container, do this:<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; container.shutdown();<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; (we may want to consider implementing AutoCloseable, an oversight on my<br class="">
&gt;&gt;&gt;&gt; part)<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; and then later on<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; - What happens if I call CDIContainerLocator in an app server<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; - It throws an IllegalStateException.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; - The container provides no beans of type CDIContainer, it is managed<br class="">
&gt;&gt;&gt;&gt; outside of the CDI container.<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; John<br class="">
&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; On Wed Feb 11 2015 at 4:21:50 AM Jozef Hartinger &lt;<a href="mailto:jharting@redhat.com" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&amp;tf=1&amp;to=jharting@redhat.com&amp;cc=&amp;bcc=&amp;su=&amp;body=','_blank');return false;" class="">jharting@redhat.com</a>&gt;<br class="">
&gt;&gt;&gt;&gt;&gt; wrote:<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; Hi John, some thoughts:<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; - instead of using BeanManager it makes more sense to me to return a<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; CDI<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; instance, which is a more user-friendly API (and it also exposes<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; access to<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; BeanManager)<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; - is there a usecase for arbitrary keys of the "params" map or is<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; Map&lt;String, ?&gt; sufficient?<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; - if we could move the shutdown() method from CDIContainer to the<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; actual<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; container handle that we obtain from initialize(), that would look<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; more<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; object-oriented<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; - what exactly is initialize() supposed to do? Is it supposed to start<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; scanning the entire classpath for CDI beans? That could be a problem<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; especially with spring-boot-like fat jars. I think we need an API to<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; tell<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; the container which classes / packages to consider. Something like<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; Guice's<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; binding API perhaps?<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; - the proposal makes me wonder whether retrofitting this functionality<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; to<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; the CDI class wouldn't be a better option. It could look like:<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; CDI container = CDI.initialize();<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; container.select(Foo.class).<u class=""></u>get();<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; container.shutdown();<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; compare it to:<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; CDIContainer container = CDIContainerLoader. getCDIContainer();<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; BeanManager manager = container.initialize();<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; manager.getBeans(...);<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; container.shutdown(manager);<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; On 02/10/2015 06:58 PM, John D. Ament wrote:<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; All,<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; I have the updated API here, and wanted to solicit any final feedback<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; before updating the google doc and spec pages.<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; <a href="https://github.com/johnament/cdi/commit/2c362161e18dd521f8e83c27151ddad467a1c01c" target="_blank" class="">https://github.com/johnament/<u class=""></u>cdi/commit/<u class=""></u>2c362161e18dd521f8e83c27151dda<u class=""></u>d467a1c01c</a><br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; Let me know your thoughts.<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; Thanks,<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; John<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; ______________________________<u class=""></u>_________________<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; cdi-dev mailing list<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; <a href="mailto:cdi-dev@lists.jboss.org" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&amp;tf=1&amp;to=cdi-dev@lists.jboss.org&amp;cc=&amp;bcc=&amp;su=&amp;body=','_blank');return false;" class="">cdi-dev@lists.jboss.org</a><br class="">
&gt;&gt;&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank" class="">https://lists.jboss.org/<u class=""></u>mailman/listinfo/cdi-dev</a><br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; Note that for all code provided on this list, the provider licenses<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; the<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; code under the Apache License, Version 2<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; (<a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank" class="">http://www.apache.org/<u class=""></u>licenses/LICENSE-2.0.html</a>). For all other ideas<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; provided on this list, the provider waives all patent and other<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; intellectual<br class="">
&gt;&gt;&gt;&gt;&gt;&gt; property rights inherent in such information.<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; ______________________________<u class=""></u>_________________<br class="">
&gt;&gt;&gt;&gt; cdi-dev mailing list<br class="">
&gt;&gt;&gt;&gt; <a href="mailto:cdi-dev@lists.jboss.org" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&amp;tf=1&amp;to=cdi-dev@lists.jboss.org&amp;cc=&amp;bcc=&amp;su=&amp;body=','_blank');return false;" class="">cdi-dev@lists.jboss.org</a><br class="">
&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank" class="">https://lists.jboss.org/<u class=""></u>mailman/listinfo/cdi-dev</a><br class="">
&gt;&gt;&gt;&gt;<br class="">
&gt;&gt;&gt;&gt; Note that for all code provided on this list, the provider licenses the<br class="">
&gt;&gt;&gt;&gt; code<br class="">
&gt;&gt;&gt;&gt; under the Apache License, Version 2<br class="">
&gt;&gt;&gt;&gt; (<a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank" class="">http://www.apache.org/<u class=""></u>licenses/LICENSE-2.0.html</a>). For all other ideas<br class="">
&gt;&gt;&gt;&gt; provided on this list, the provider waives all patent and other<br class="">
&gt;&gt;&gt;&gt; intellectual<br class="">
&gt;&gt;&gt;&gt; property rights inherent in such information.<br class="">
&gt;&gt;<br class="">
&gt;&gt;<br class="">
&gt;<br class="">
</blockquote></div></div></div>
</blockquote></div></blockquote></div></div></div>
_______________________________________________<br class="">cdi-dev mailing list<br class=""><a href="mailto:cdi-dev@lists.jboss.org" class="">cdi-dev@lists.jboss.org</a><br class="">https://lists.jboss.org/mailman/listinfo/cdi-dev<br class=""><br class="">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.</div></blockquote></div><br class=""></body></html>