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

HFEJB pg 371: question about ejbRemove (q#16)

 
Krishnan Kannan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

The question 16 on page 371 is: Which additional method(s) might the container call when invoking ejbRemove ?

The answers according to the book is ejbLoad() and ejbActivate().

I was thinking only ejbLoad(). I checked the spec pg.176 and for ejbRemove it doesn't mention anything about ejbActivate().

So what is the correct answer. Why would ejbActivate be called ?

Thanks,
Krishnan Kannan
 
Thilina Annakkage
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because there is a possibility that bean is in the pool. ejbLoad cannot be called on a bean in the pool. So, ejbActivate will be called before ejbLoad in this case.

Please see the life cycle diagram in page 320 of HFEJB for more clarification.

Thilina
 
Krishnan Kannan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Thilina.

When I look at the lifecycle diagram on pg 320, 321 on HFEJB, it doesn't convey the meaning of ejbActivate getting executed when ejbRemove is called.

Nevertheless, I can see your point where the bean is in the pool and when ejbRemove is called, it gets activated, loaded and then removed. Seems like these are unnecessary activites during removal.

Thanks,
Krishnan Kannan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic