• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

moves from [pooled] to [method ready]

 
Shiang Wang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am reading about CMP life cycle on HFEJB, and observed some behaviors in Weblogic which is not consistent with what I think the book says. Can someone answer my doubt?

When an entity bean moves from pooled to method ready, does it mean that the bean is pulled out Bean Pool? (I am trying to match what happen in the CMP life cycle diagram with those cool pictures of interaction between client, container and bean)
If it is true, then why Weblogic container calls
1. ejbActivate()
2. ejbLoad()
3. ejbStore()
when the client calls ejbFindByPrimaryKey() on EJBHome. According to page 339, finder method doesn't make entity bean come out of the pool. Well ejbActivate() moves the bean from pooled to method ready.

Second question is, why does the container call ejbLoad() and ejbStore() on every getter and setter method. I would think ejbStore() is only needed for setter and ejbLoad() is only needed for getter.

Isn't it inefficient for EJB to behave this way ?

Thanks
Shiang
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am reading about CMP life cycle on HFEJB, and observed some behaviors in Weblogic which is not consistent with what I think the book says.
That wouldn't surprise me

When an entity bean moves from pooled to method ready, does it mean that the bean is pulled out Bean Pool?
Yes, see section 10.5.1 of the EJB 2.0 specification.

If it is true, then why Weblogic container calls
1. ejbActivate()
2. ejbLoad()
3. ejbStore()
when the client calls ejbFindByPrimaryKey() on EJBHome

There are two ways for a bean to transit from the pooled state to the method ready state:
- ejbCreate or ejbPostCreate methods (not the case here)
- ejbActivate because a bean needs to service a client's call

You are right when you say that when ejbFind method are called, the bean instances are NOT pulled out of the pooled state.
I don't really have an explanation of why Weblogic works that way. All I can say is that I have been delving in Weblogic's code for a couple months now and I can tell you that I somehow understand why this is so

Second question is, why does the container call ejbLoad() and ejbStore() on every getter and setter method. I would think ejbStore() is only needed for setter and ejbLoad() is only needed for getter.
Again, having delved into WL's code, I can tell you that it is far from being efficient. I suspect that there is code generation behind that... I'm sorry I don't have any further explanation. Maybe someone else could help.

Isn't it inefficient for EJB to behave this way ?
Well, unneeded method calls are always inefficient.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic