<font size=2 face="sans-serif">Hello Martin <br>
<br>
I use weld 2.4; I tested this in liberty and wildfly-10.1.0.Final<br>
<br>
Regards<br>
Benjamin</font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Martin Kouba &lt;mkouba@redhat.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">To: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Benjamin Confino &lt;BENJAMIC@uk.ibm.com&gt;,
weld-dev@lists.jboss.org, </font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Emily Jiang &lt;EMIJIANG@uk.ibm.com&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">09/08/2017 11:42</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size=1 face="sans-serif">Re: [weld-dev]
Dependent Scoped bean aquired by CDI.current() is not destroyed</font>
<br>
<hr noshade>
<br>
<br>
<br><tt><font size=2>Hi Benjamin,<br>
<br>
the lifecycle of @Dependent instances created through <br>
javax.enterprise.inject.spi.CDI is not well defined. So it's always <br>
better to destroy such instances when not needed. However, it would make
<br>
sense to destroy such instances during shutdown.<br>
<br>
I believe this works in Weld SE. What environment/runtime do you use?<br>
<br>
Martin<br>
<br>
Dne 9.8.2017 v 11:52 Benjamin Confino napsal(a):<br>
&gt; Hello<br>
&gt; <br>
&gt; I have a servlet that acquires two instances of a dependent scoped
bean. <br>
&gt; The first is aquired by @Inject Instance&lt;CdiBean&gt; the second
is acquired <br>
&gt; via CDI.current().select(CdiBean.class).get().<br>
&gt; <br>
&gt; I can see that the first instance's @PreDestroy is called when I shut
<br>
&gt; down the application. However @PreDestroy is not called on the instance
<br>
&gt; acquired CDI.current. Here is the source:<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; My question is, is this behaviour intentional? And if it is, can you
<br>
&gt; please link me to the appropriate part of the spec that says when
we <br>
&gt; should expect a @Dependent bean created by CDI.current to be destroyed?
<br>
&gt; I have a customer concerned about this causing a potential memory
leak.<br>
&gt; <br>
&gt; Regards<br>
&gt; Benjamin<br>
&gt; Unless stated otherwise above:<br>
&gt; IBM United Kingdom Limited - Registered in England and Wales with
number <br>
&gt; 741598.<br>
&gt; Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
PO6 3AU<br>
&gt; <br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; weld-dev mailing list<br>
&gt; weld-dev@lists.jboss.org<br>
&gt; </font></tt><a href="https://lists.jboss.org/mailman/listinfo/weld-dev"><tt><font size=2>https://lists.jboss.org/mailman/listinfo/weld-dev</font></tt></a><tt><font size=2><br>
&gt; <br>
<br>
-- <br>
Martin Kouba<br>
Senior Software Engineer<br>
Red Hat, Czech Republic<br>
<br>
</font></tt>
<br><font size=2 face="sans-serif"><br>
Unless stated otherwise above:<br>
IBM United Kingdom Limited - Registered in England and Wales with number
741598. <br>
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU<br>
</font>