aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Page 282 Head First EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Page 282 Head First EJB" Watch "Page 282 Head First EJB" New topic
Author

Page 282 Head First EJB

Girija Siva
Ranch Hand

Joined: Apr 23, 2004
Posts: 41
Hi all
On page 282
Under "Stateful session bean remove()"
in second point it saus ejbRemove() will be called unless the bean is already passivated. How can we call remove() in the firstplace when the bean is passivated??? Does not remove() is called means the bean is active???
Thanks
Vaithiya Sundaram
Ranch Hand

Joined: Apr 22, 2004
Posts: 98
You can still call remove() on the bean which is passivated.
In this case the bean will be activated and then removed.


Vaithiyanathan Sundaram<br />SCJP, SCBCD, SCEA part1
Girija Siva
Ranch Hand

Joined: Apr 23, 2004
Posts: 41
HI Vaithiya
Thanks for the reply But.......
You can still call remove() on the bean which is passivated.In this case the bean will be activated and then removed
My understanding is, in that case ejbRemove() will be called. It is no different than calling the remove() when it is not passivated. But the statement in the book says ejbRemove() is not called ( when remove() is called on a bean in passivated state)
Dale Seng
Ranch Hand

Joined: Mar 22, 2004
Posts: 275
I agree that what's in the book is confusing. One may conclude, incorrectly, that remove() called on a passivated bean would mean a fourth way to get a "missed ejbRemove() call".
Given the fact that the book (215) and the spec (82) state that there are only three things that can cause a "missed ejbRemove() call" (server crash, timeout while passivated, bean throws a system exception), and that a client calling "remove()" while the bean is passivated is NOT one of the three, I must conclude that indeed the bean would get activated and then ejbRemove() would get called.
So if all of that is true, then the book should eliminate the following "(unless the bean is already passivated)", or maybe replace it with "(with a possible intermediate step of activation if the bean happens to be passivated at the time of the remove call)".
--Dale--
Santosh Ramachandrula
Ranch Hand

Joined: Apr 04, 2004
Posts: 252
Head First EJB Page 253
Question# 7 What is true about Session Bean's Life cycle?
Option B --> A passivated bean must be activated before it can be removed is not checked
The explanation for option B is nope.
Are the book writers right?
I have no clue why is it nope? Any explanations or am I supposed to memorize this point??


Thanks,
Santosh
Suman Sarker
Ranch Hand

Joined: May 06, 2004
Posts: 68
Hi All,
Stateful session beans (while passivated) can be removed either by the Container or by the Client. The Container removes a passivated bean when the bean times out. But in the case of Client calling the remove() method, Container treats it as just another business method call.
So, if it's the Client who is making the remove() method call, the Container will first activate the passivated bean and then the remove()method wil be invoked. So, in this case there is no "missed ejbRemove()" call.
On the other hand, if the bean times out while passivated, the Container kills the bean without calling "ejbRemove()". Therefore, we have a "missed ejbRemove()" call in this case.
Hope this clears the confusions.


Suman A Sarker<br />SCJP, SCWCD, SCBCD<br /> <br />If You Can't Beat Them ... Join Them!
Girija Siva
Ranch Hand

Joined: Apr 23, 2004
Posts: 41
Hi Santosh
Head First EJB Page 253
Question# 7 What is true about Session Bean's Life cycle?
Option B --> A passivated bean must be activated before it can be removed is not checked
The explanation for option B is nope.
Are the book writers right?
I have no clue why is it nope? Any explanations or am I supposed to memorize this point??

In this question it does not talk about remove() method by the client. It says remove in general. A passivated bean can timeout
Where as on page 282 the authors are talking about the remove() method call on the bean by client. I still think "unless the bean is already passivated" should be something like " unless the bean is already passivated and timed out"
Thanks
 
Consider Paul's rocket mass heater.
 
subject: Page 282 Head First EJB