• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

moves from [pooled] to [method ready]

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I AM MIGHTY! Especially when I hold this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic