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

bean instance life cycle

 
Walter Vetrivel
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam referring to monson haefel book page 170 figure 6-1, which decribes a part of the life cycle of a bean instance,
Also refer to the figure that gives a full life cycle of a ENTITY bean instance i.e fig 6-2 page 211.
I have understood from fig 6-2, that for a bean instance to transition from the "does not exist" state to "pooled state" the sequence of container methods that are called are
Class.newInstance();
setEntityContext();
To transition from the pooled state to ready state the following methods
are called
ejbCreate();
ejbPostCreate();
My doubt comes up when I see the fig 6-1 which indicates a sequence diagram showing method sequence for bean instance creation as
ejbCreate();
ejbPostCreate();
Class.newInstance();
What am I missing here??
 
Danl Thompson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In step 9 of the sequence diagram figure 6-1, you are seeing the remote interface (EJBObject) of the Entity being instantiated with the Class.newInstance() call. In figure 6-2 the Class.newInstance instantiates the Entity itself.
dan'l
 
Walter Vetrivel
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in fig 6-1 step 7 the ejbobject is associated with a bean instance, that means the ejb object has already been instantiated isnt it?? then why would it need to be instantiated again in step 9.
Thanks
Walter
 
Amanda Waite
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Walter,
As Dan'l says, the call to newInstance() will actually create the stub object that will represent the EJB Object on the client side. The stub object is the return value of the clients create() call on the home object. It's a proxy object that implements the remote interface The client calls methods on the stub object and these are forwarded from the client to the EJB Object using RMI-IIOP.
Amanda
 
Walter Vetrivel
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Danl and Amanda, its clear now.
Walter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic