I wrote this simple Stateless Session bean example (taken from EJB 3.1 Cookbook). When the bean method computeVolume is invoked (through servlet) I can see the method with @PostConstruct being called, but when I stop the server (Jboss AS 7.1 Final) , the print statement in method with @PreDestroy is not called.
Is it normal, from what I understand is this method should be called when a bean is destroyed , which will happen when the server shuts down. Why in that case am I not seeing this being called?
I tried the same example with the Wildfly 8.0.0 Final and it worked as expected. Both the @PostConstruct and @PreDestroy methods are called, in-fact I didn't even need to shutdown server, the @PreDestroy method was called immediately after the call is returned from the method invoked from servlet.
Thanks for your help.
I can't beleive you just said that. Now I need to calm down with this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop