This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ejbCreate/ejbRemove for stateless bean

 
Tomek Bo
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've read that in this callback methods it is possible to take a reference to EJBObject throught SessionContext (table 3 page 90 in spec). But how it can be possible, if this methods are called by the container to change a size of the pool. so there is no client and no EJBObject (figure 15 and 16 on page 94). thanks in advance for help

bo
 
Gabriel Buheler
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cannot figured out either, the reason.

Anyone???

 
Tomek Borek
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sometimes asking gut question give a good result: with 97% I've passed the exam. But still I don't know the answer...

regards
 
krishnakumar ramamurthy
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a good explanation for this. And remember the SessionContext is still available from those methods.

http://www.coderanch.com/t/158485/java-EJB-SCBCD/certification/beanness-stateless-session-bean.
 
Jeff Walker
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tomek Bo:
I've read that in this callback methods it is possible to take a reference to EJBObject throught SessionContext (table 3 page 90 in spec). But how it can be possible, if this methods are called by the container to change a size of the pool. so there is no client and no EJBObject (figure 15 and 16 on page 94). thanks in advance for help

bo


There is always an EJBObject for anything that has a remote component interface. (Local component interface as well, I believe). Just because the diagram may not show you it, each bean in a pool has an associated EJBObject. Also, ejbRemove() is called just before a bean is removed from the pool, (it's your last chance to clean it up theoretically), and at that point the EJBObject still exists for it. One more point, all objects in a pool are on the heap, and as such are real objects, they also have a partner object, the EJBObject. (Often not shown in pool diagrams for simplicity, since it's confusing to remember that the EJBObject actually stands in for the bean).
I believe this is how it works.
-jeff
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic