• Post Reply Bookmark Topic Watch Topic
  • New Topic

Message Driven Bean EJBRemove()  RSS feed

 
Ranch Hand
Posts: 495
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am testing a Message Driven Bean. Please at what point does the EJBRemove() method gets called. Because i am planning to open a database connection in the ejbCreate() method and also add code to close the connection in the ejbremove method
 
author & internet detective
Marshal
Posts: 38391
649
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abiodun,
See the bottom of Sun's tutorial for the lifecyle of an MDB. Basically ejbRemove() gets called when the container decides it is done with bean and wants to make it available for garbage collection.

That's a long time to keep a connection open. Since an MDB is stateless, the time between ejbCreate and ejbRemove could be days. Or even longer!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!