This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
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?
Howdy, 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. cheers, Kathy
Co-Author of <a href="http://www.amazon.com/exec/obidos/ASIN/0596007124/ref=jranch-20" target="_blank" rel="nofollow">"Head First Design Patterns"</a><br /> <br />Just a Jini girl living in a J2EE world.
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.