[cdi-dev] cyclic references
Mark Struberg
struberg at yahoo.de
Mon Nov 26 09:18:40 EST 2012
yes, accessing via calling it ;)
LieGrue,
strub
----- Original Message -----
> From: Pete Muir <pmuir at redhat.com>
> To: Mark Struberg <struberg at yahoo.de>
> Cc: cdi-dev <cdi-dev at lists.jboss.org>
> Sent: Monday, November 26, 2012 2:53 PM
> Subject: Re: [cdi-dev] cyclic references
>
> I don't believe the spec is updated for this. BTW I assume you mean
> *calling* cyclic references from those methods?
>
> On 24 Nov 2012, at 16:58, Mark Struberg wrote:
>
>> Hi Folks!
>>
>> I know we already discussed that cyclic references in @PostConstruct and
> @Inject methods are not allowed (btw, did we also nail this down in the spec
> properly? This is implicitly defined in commons-annotations).
>>
>> But what about @PreDestroy? As the destroy order is not defined for
> normalscoped beans it could happen that a bean already got wiped and destroyed
> while another one likes to access it. So it's not only a problem of cycles,
> but might also happen without.
>>
>> sample:
>>
>> @RequestScoped
>>
>> public class BeanA {
>> @Inject BeanB b;
>>
>> @PreDestroy
>> public void destroyMe() {
>> b.dosomething();
>> }
>> }
>>
>> and
>>
>>
>> @RequestScoped
>>
>> public class BeanB {
>> public void dosomething() {..}
>>
>> @PreDestroy
>> public void dropDatabaseConnection() {...}
>>
>> }
>>
>> Now lets imagine that BeanB got destroyed earlier than BeanA ....
>>
>>
>> It's atm purely random. Imo this is ok, but should we point users to
> this behaviour?
>>
>> LieGrue,
>> strub
>>
>>
>> _______________________________________________
>> cdi-dev mailing list
>> cdi-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
More information about the cdi-dev
mailing list