wood burning stoves
The moose likes EJB and other Java EE Technologies and the fly likes statefulsessionbean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "statefulsessionbean" Watch "statefulsessionbean" New topic


eswar kumar
Ranch Hand

Joined: Oct 20, 2002
Posts: 98
how a stateful session bean maintain state (every time the request is coming from that particular client)? if the client wants to browse after 30 mints of idle time how the bean instance knows that request is coming from that parcticular client?
Kathy Sierra
Cowgirl and Author

Joined: Oct 10, 2002
Posts: 1589
How the Container actually associates the stateful session bean with a particular client is up to the vendor.
You can imagine that the stub object contains enough information to identify the client uniquely to the Container, and that this information is enough for the Container to pull a bean out of passivation and restore its state when the client comes back and makes another method call.
But the exact implementation mechanism the Container uses to uniquely identify a client, and to restore state after passivation (or even HOW and IF the Container passivates stateful session beans) is not part of the spec, and is entirely the choice of the vendor.

Co-Author of Head First Design Patterns
Just a Jini girl living in a J2EE world.

Joined: Nov 26, 2003
Posts: 1
Actually what happens when client is idle are not invoking any method or using stateful bean, container detects its idleness and prepare to passivate to free resources used by it. during passivation container calls ejbPassivate method on bean and save all non transient state of bean class in secondary memory. Along with data it also stores references of ejbObject, ejbContext, Home Object which are not released by client during passivation. So when passivated clent call some method on ejbObject associated with it, it retrives references and previous conversational state and activate bean.
I agree. Here's the link: http://aspose.com/file-tools
subject: statefulsessionbean
It's not a secret anymore!