<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:
</font><font size=1 face="sans-serif">Martin Kouba <mkouba@redhat.com></font>
<br><font size=1 color=#5f5f5f face="sans-serif">To:
</font><font size=1 face="sans-serif">Benjamin Confino <BENJAMIC@uk.ibm.com>,
weld-dev@lists.jboss.org, </font>
<br><font size=1 color=#5f5f5f face="sans-serif">Cc:
</font><font size=1 face="sans-serif">Emily Jiang <EMIJIANG@uk.ibm.com></font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date:
</font><font size=1 face="sans-serif">09/08/2017 11:42</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject:
</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>
> Hello<br>
> <br>
> I have a servlet that acquires two instances of a dependent scoped
bean. <br>
> The first is aquired by @Inject Instance<CdiBean> the second
is acquired <br>
> via CDI.current().select(CdiBean.class).get().<br>
> <br>
> I can see that the first instance's @PreDestroy is called when I shut
<br>
> down the application. However @PreDestroy is not called on the instance
<br>
> acquired CDI.current. Here is the source:<br>
> <br>
> <br>
> <br>
> My question is, is this behaviour intentional? And if it is, can you
<br>
> please link me to the appropriate part of the spec that says when
we <br>
> should expect a @Dependent bean created by CDI.current to be destroyed?
<br>
> I have a customer concerned about this causing a potential memory
leak.<br>
> <br>
> Regards<br>
> Benjamin<br>
> Unless stated otherwise above:<br>
> IBM United Kingdom Limited - Registered in England and Wales with
number <br>
> 741598.<br>
> Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire
PO6 3AU<br>
> <br>
> <br>
> _______________________________________________<br>
> weld-dev mailing list<br>
> weld-dev@lists.jboss.org<br>
> </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>
> <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>