• Post Reply Bookmark Topic Watch Topic
  • New Topic

Callback method @Predestroy not called when Jboss server stopped  RSS feed

 
Pallavi Sadit
Ranch Hand
Posts: 45
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?



 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you try this against WildFly 8.1.0.Final http://wildfly.org/downloads/ (JBoss AS has been renamed to WildFly)?
 
Riaan Nel
Ranch Hand
Posts: 160
IntelliJ IDE Ubuntu VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you stop the server? If it shuts down cleanly (via a shutdown command) I would expect it to work, but if you just kill the process your callback method probably won't get called.
 
Pallavi Sadit
Ranch Hand
Posts: 45
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Riaan,
I am stopping the server, not killing it. I am using Eclipse IDE and starting and stopping the server from there, can it make a difference?

Jaikiran,
I am yet to try out Wildfly8.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I remember, there was a bug in this area in 7.1.1.Final of JBoss AS. That's why I recommend trying out WildFly 8 latest release.
 
Pallavi Sadit
Ranch Hand
Posts: 45
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jaikiran,
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!