Hi! I was reviewing the calls to InstanceManager.destroyInstance( ) in view of r1428645 and its followups. This method is essentially responsible for calling methods annotated as @PreDestroy.
The documentation here are chapters 15.5.9/15.5.10 of Servlet 3.0 Rev a and chapters 2.5/2.6 of JSR250 Common Annotations 1.1 There are several questions that remain for me. 1) Calling PreDestroy methods if destroy() method fails. I think that PreDestroy methods should be called even if destroy() fails. For Filters it was fixed by r1428645 . For Servlets this is yet to be fixed. I think this has to be fixed, similar to r1428645. 2) Calling PreDestroy methods if init() method fails. The specs say that - if @PostConstruct methods fail then nothing is called afterwards, and - if init() fails then destroy() is not called. I wonder whether failure of init() precludes @PreDestroy methods from being called. The current implementation is that they are not called. I feel some concern as JSR250 and Servlet API are different APIs, and in view of r1429173 which fixed a similar issue with cache in SecurityUtil. 3) Besides annotations there are web.xml elements "<pre-destroy>" and "<post-construct>". I do not see any proper documentation for them in the Servlet spec (besides being mentioned in the fragment merging rules in ch.8.2.3). Quick googling found this example from Jetty wiki: http://wiki.eclipse.org/Jetty/Feature/Annotations#Lifecycle_callbacks:_PostConstruct_PreDestroy They are also mentioned in JavaEE 6 Platform Specification (ch. EE.5.2.5), which mentions that they are equivalent to annotations. A question is that searching by the tag names I do not see any code in Tomcat that handles them. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org