<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 26 Apr 2011, at 22:58, Rick Hightower wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Inline...<br><br><div class="gmail_quote">On Tue, Apr 26, 2011 at 12:38 AM, Peter Muir <span dir="ltr">&lt;<a href="mailto:pmuir@redhat.com">pmuir@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><br><div><div class="im"><div>On 26 Apr 2011, at 00:07, Rick Hightower wrote:</div><br></div><div class="im"><blockquote type="cite">We need a general purpose way of finding a BeanManager.<div>
+1 for me.</div></blockquote><div><br></div></div><div>I agree, this is something we can make easier for CDI 1.0. In part we need to see what the javax.inject EG comes up with here, as we build on their foundations.&nbsp;<div>
<br></div><div>FTR this is a (possibly the?) reason CDI moved away from having a "Container" API -- this is supposed to be addressed by JSR-330 part 2, and so was intentionally left out of CDI 1.0 so that we didn't end up with an inconsistent approach. I need to check with the EE spec lead on the status of the 330-part2 work.</div>
</div></div></div></blockquote><div><br></div><div>Ok.</div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div><div class="im">
<br><blockquote type="cite"><div><br></div><div>This way should include JNDI lookup to a fallback BeanManagerLocator that uses a ServiceLoader</div><div>+1 for me.</div></blockquote><div><br></div></div><div>Regarding design for this feature, we should keep it as low footprint in terms of specification and API class as possible, as (always) the impl can make a better decision about how to locate the BM than we can. Rick, can you elaborate on why you want all these additonal JNDI lookup, system property lookup, priority lookup stuff?&nbsp;Comments on each in line.</div>
<div class="im"><br><blockquote type="cite"><div>
<br></div><div>I think the behavior should look like this:</div><div><br></div><div><ul><li>Lookup BeanManager in JNDI</li></ul></div></blockquote></div><div>We should avoid requiring this. JNDI lookups are expensive (they require synchronization) compared to straight singleton lookups (which at least two CDI impls, Weld and OWB support today).</div>
</div></div></blockquote><div><br></div><div>Ok. But don't singletons wreak havoc with classloaders. What if CDI was being used as library in a container that did not support CDI (jetty, tomcat). Wouldn't we want to avoid singletons?</div></div></blockquote><div><br></div><div>Singletons can be implemented in many ways, they don't have to be static based (which I think you are referring to in your comment) - suggest you take a look at the way this is implemented in GlassFish or Weld for example (or I think OWB has a similar concept)</div><br><blockquote type="cite"><div class="gmail_quote">
<div><br></div><div>I am ok with dropping JNDI lookup. The CDI container should be in a well known locations stored in the ServletContext, i.e., application scope. There should be no classical singleton. There should be nothing that would prevent a web application restart. We should not assume that CDI will only be used by Java EE 6. It should be OSGI, web&nbsp;application, re-loadable friendly.</div></div></blockquote><br><blockquote type="cite"><div class="gmail_quote"><div>I mentioned JNDI because currently the BeanManager is stored in JNDI.</div></div></blockquote><div><br></div><div>In general I think this is swerving too much into specifying implementation. We certainly musn't specify that the Bean Manager must be *stored* in the servlet context or in JNDI, this is an implementation detail.</div><div><br></div><div>What we can do is say that the BM is available for lookup from the ServletContext or JNDI or via a static method on an API class.</div><br><blockquote type="cite"><div class="gmail_quote"><div><br></div><div>&nbsp;</div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; ">
<div style="word-wrap:break-word"><div><div class="im"><br><blockquote type="cite"><div><ul><li>If not found, try to load&nbsp;BeanManagerLocator from system property.</li></ul></div></blockquote></div><div>What is the use case for this?</div>
</div></div></blockquote><div><br></div><div>Flexibility. Let CDI be used in places we have not thought of.</div></div></blockquote><div><br></div><div>That's not a usecase, that's a get out for not having a usecase ;-) We need to stick to addressing concrete usecases that have real world applications. So, unless we can come up with a real use case for this, it shouldn't be put in the spec.</div><br><blockquote type="cite"><div class="gmail_quote"><div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><div><div class="im"><br><blockquote type="cite"><div><ul><li>If not found, try to load BeanManagerLocator from ServiceLoader.</li></ul></div></blockquote><blockquote type="cite"><div><ul>

<li>If more than one&nbsp;BeanManagerLocator found, sort by priority or die if there is more than one. (not sure about the sort, I think it should die, but can be convinced otherwise).</li></ul></div></blockquote></div><div>Why can it not just be that a service loader is used to find the BeanManagerLocator, and that there must not be more than one property name in use (if there is, it's an error).</div>
<div><br></div><div>I doubt more than one CDI impl (due to scanning) can be running at the same time, and I'm also not sure this is useful.</div></div></div></blockquote><div><br></div><div>I agree. There should be only one. If there is more than one, it is an error. I was trying to include the logic that was in Solder. The stuff I have done, throws as exception if more than one is found.</div></div></blockquote><div><br></div><div>Because Solder is an extension which is working with multiple impl's of CDI it needs to jump through hoops that a spec based impl doesn't need.</div><br><blockquote type="cite"><div class="gmail_quote">
<div>&nbsp;</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div><div class="im"><blockquote type="cite"><div><ul><li>Once the BeanManagerLocator is found, use it to return a BeanManager</li>
</ul></div></blockquote><div><br></div><div><div><br></div></div><br></div><blockquote type="cite"><div class="im"><div><ul>
</ul></div><div><br></div><div>In addition,</div><div><br></div><div>I think we need a simplified interface for&nbsp;BeanManager.&nbsp;</div><div><br></div><div><a href="https://github.com/CDISource/cdisource/blob/master/beancontainer/api/src/main/java/org/cdisource/beancontainer/BeanContainer.java" target="_blank">https://github.com/CDISource/cdisource/blob/master/beancontainer/api/src/main/java/org/cdisource/beancontainer/BeanContainer.java</a></div>

<div><br></div><div>This could just be a utility class, but it should be included with CDI 1.1. I think the &nbsp;BeanManager interface is too low level.</div><div><br></div><div><br></div><div><br>-- <br>
<b>Rick Hightower</b><br><a href="tel:%28415%29%20968-9037" value="+14159689037" target="_blank">(415) 968-9037</a> <br><a href="http://www.google.com/profiles/RichardHightower" target="_blank">Profile</a>&nbsp;<br><br>
</div></div><div class="im">
_______________________________________________<br>cdi-dev mailing list<br><a href="mailto:cdi-dev@lists.jboss.org" target="_blank">cdi-dev@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
</div></blockquote></div><br></div></blockquote></div><br><br clear="all"><br>-- <br><b>Rick Hightower</b><br>(415) 968-9037 <br><a href="http://www.google.com/profiles/RichardHightower" target="_blank">Profile</a>&nbsp;<br><br>

</blockquote></div><br></body></html>