<p dir="ltr"><br>
Le 16 mai 2016 10:01, "Martin Kouba" <<a href="mailto:mkouba@redhat.com">mkouba@redhat.com</a>> a écrit :<br>
><br>
> Dne 15.5.2016 v 16:14 John D. Ament napsal(a):<br>
> > Hey guys<br>
> ><br>
> > Seems like we have some issues in JIRA all focused on managing the<br>
> > lifecycle of Dependent scoped beans. It also seems like we have many<br>
> > differing opinions about how to manage them.<br>
> ><br>
> > - Martin raised a PR to add a release() method to Instance to help<br>
> > destroy a dependent bean <a href="https://github.com/cdi-spec/cdi/pull/286">https://github.com/cdi-spec/cdi/pull/286</a><br>
> > - I raised a PR <a href="https://github.com/cdi-spec/cdi/pull/289">https://github.com/cdi-spec/cdi/pull/289</a> to update the<br>
> > spec to clarify how to manage a dependent scoped bean.<br>
> ><br>
> > Right now, it seems that the big disagreement is whether<br>
> > Instance.destroy() can destroy objects not created by it (the case being<br>
> > around the CDI utility class, being an impl of Instance). I'm currently<br>
> > heavily against Martin's proposed changes, but want to get input from<br>
> > others on the group to understand their perspective.<br>
> ><br>
> > - Does the spec require destroy() to be called only on instances that it<br>
> > created? When I read 5.6.1 the only requirement I see is that it has to<br>
> > be a dependent scoped bean. Note when I ask this I'm asking from the<br>
> > spec perspective, its a different problem if there's some issues with<br>
> > implementations following suite (I would imagine there needs to be some<br>
> > shared global registry of dependent scoped beans for this to work).<br>
> ><br>
> > - Do we want two methods that effectively do the same thing? I don't<br>
> > see a strong difference between the two.<br>
><br>
> Instance.destroy() currently always destroys the contextual instance.<br>
> Which is not always what users expect. That's why I proposed to add<br>
> Instance.release() - <a href="https://github.com/cdi-spec/cdi/pull/286">https://github.com/cdi-spec/cdi/pull/286</a>,<br>
> previously Instance.getBean() - <a href="https://github.com/cdi-spec/cdi/pull/273">https://github.com/cdi-spec/cdi/pull/273</a>.<br>
></p>
<p dir="ltr">Since you give the instance to both I guess the intention from user point of view is obvious and then we dont need 2 methods. What would be the other use case?<br></p>
<p dir="ltr">> ><br>
> > On the flipside, my change is more a spec clarification. I'm thinking<br>
> > more now that it belongs as a reword of 5.6.1 to clarify how to use<br>
> > destroy() on dependent beans, rather than where I put it. I think<br>
> > realistically we have all of the tools needed to manage the lifecycle of<br>
> > these classes, just need to clarify them for people to use.<br>
> ><br>
> > John<br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > cdi-dev mailing list<br>
> > <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
> > <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
> ><br>
> > Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (<a href="http://www.apache.org/licenses/LICENSE-2.0.html">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br>
> ><br>
><br>
> --<br>
> Martin Kouba<br>
> Software Engineer<br>
> Red Hat, Czech Republic<br>
> _______________________________________________<br>
> cdi-dev mailing list<br>
> <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
><br>
> Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (<a href="http://www.apache.org/licenses/LICENSE-2.0.html">http://www.apache.org/licenses/LICENSE-2.0.html</a>). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.<br>
</p>