jsr345-experts@ejb-spec.java.net

[jsr345-experts] Re: Order of _at_PreDestroy method calls?

From: Pete Muir <pmuir_at_bleepbleep.org.uk>
Date: Fri, 22 Jul 2011 09:45:05 +0100

My thoughts are:

* neither CDI nor AtInject specify this (phew!)
* that yes, this does seem a more logical way to define this
* that the number of apps/libraries depending on this ordering are probably small
* however that apps/libraries which do depend on this ordering would probably fail pretty catastrophically (e.g. not freeing up resources)
* that I never seen this raised "in the wild"

My instinct is to leave this alone unless we have a significant number of users complaining.

On 22 Jul 2011, at 02:11, Marina Vatkina wrote:

> Bill Shannon asked me to get the EJB EG opinion on this subject. Had this been discussed in 3.1 EG?
>
> thanks,
> -marina
>
>
> On 5/16/2011 2:05 PM, Bill Shannon wrote:
>> Section EE.5.2.5 of the EE 6 platform spec (page 70) says that both
>> @PostConstruct and @PreDestroy methods are called in class hierarchy
>> order, with superclass methods called before subclass methods. This
>> makes sense for @PostConstruct, but for @PreDestroy it seems like it
>> would make more sense to call them in reverse order, so that the
>> subclass would be done using any resources of the superclass before
>> the superclass freed them.
>>
>> Can anyone think of any reason that @PreDestroy should be called in
>> the same order as @PostConstruct?
>>
>> If we decided the currently specified behavior is wrong, I'm worried
>> about the compatibility impact of changing it. What do *you* think
>> the compatibility impact would be? How many programs would break?