It's not a secret anymore!*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Passivation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Passivation" Watch "Passivation" New topic
Author

Passivation

ShivPrakash Srivastava
Ranch Hand

Joined: Mar 24, 2005
Posts: 88
Can a bean can be removed(Killed) in its passivated state may be due to timeout or any other reason

Thanks
Shiv
Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
SSB are removed by the container when timeout occurs in passivated state. (bean goes from passivated state to Does not exist state.)
No ejbRemove method is called during such scenario.
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Originally posted by ShivPrakash Srivastava:
Can a bean can be removed(Killed) in its passivated state may be due to timeout or any other reason

Thanks
Shiv


It depends on what do you mean by removed/killed. Are you refering to the invocation of the ejbRemove method? Or a transition from the passivated state to "does not exist" state.

If you recall from the life-cycle diagram of a stateful session bean or entity bean, when the bean is in passivated state, it can transit back to the "does not exist" state after a timeout. Also, ejbRemove method is not invoked at all.


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
ShivPrakash Srivastava
Ranch Hand

Joined: Mar 24, 2005
Posts: 88
Hi

But is time-out is the only way by which the bean bean transits to "does not exist state ".Even in its passivated state the bean is still referenced by the EJBObject,the only thing is it cannot be invoked(both for stateful as well as entity bean).Can we call ejbRemove() on a passivated bean?

Thanks
Shiv
Chetan Sahasrabudhe
Ranch Hand

Joined: Aug 09, 2004
Posts: 75
hmmm ....

Passivation is something limilar to serialization.
Imagine the scenario that you are going through 3 books to pass SCBCD.
After a while you thought that you are done with Book_1 and so the book is no more on your table but is sitting on the shelf.

Passivated bean is something like Book_1.

Unless and until you get the book to your table, you will not be able to do anything with the book.

Even to throw the book out of your room, you will first have to get it out of the shelf state and then act on it i.e. throw it out of the room.

HF states the reason why container does not call remove on passivated bean when the bean times out.

The reason given is, why should the container bother to activate the bean again just to call remove method. Better save the CPU cycles and put it out of the pool directly.


Thanks & Regards<br />Chetan
ShivPrakash Srivastava
Ranch Hand

Joined: Mar 24, 2005
Posts: 88
Hi

Thanks Chetan for your comments with a good example

Regards
Shiv
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Originally posted by ShivPrakash Srivastava:
But is time-out is the only way by which the bean bean transits to "does not exist state ".


Nope, if the bean throws any system exception, it will transit to the "does not exist state" as well.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passivation
 
Similar Threads
Can the color for the disabled item be changed
WA #1.....word association
Private methods
URGENT - NEED HELP - Block Code
error in Marcus Green 2.