• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Page 282 Head First EJB

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can still call remove() on the bean which is passivated.
In this case the bean will be activated and then removed.
 
Girija Siva
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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--
 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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??
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Girija Siva
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
If you send is by car it's a shipment, but if by ship it's cargo. This tiny ad told me:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic