Title: Message Title
|
|
Hi [~munzi82]
First of all, thanks for the report.
I would start by pointing out that what you are trying isn't exactly good practice and in fact neither is this supported. I am talking about invoking one request scoped bean from within {{@PreDestroy}} callback of another request scoped bean.
Since CDI spec doesn't define any order in which to handle these callbacks, you cannot rely on it. To demonstrate this - it can easily happen that the bean you are referencing in the callback no longer exists as it was destroyed prior to your bean. The callback will still execute but the bean will be created anew which will likely have side-effects you don't want (as no state would be preserved). You can quite reliably call other beans with "wider" scope than the one you are destroying, e.g. referencing application scoped bean in pre-destroy callback of request scoped bean should be safe.
With the above in mind, I am not sure whether we should look into fixing this rare glitch or rather advice you to restructure the original code as it cannot be relied upon. WDYT? |
|
|
|
|
|
_______________________________________________
weld-issues mailing list
weld-issues@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/weld-issues