The moose likes EJB and other Java EE Technologies and the fly likes EJB-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 "EJB-StatefulSessionBean" Watch "EJB-StatefulSessionBean" New topic


somasundaram s

Joined: Aug 25, 2001
Posts: 3
Stateful sessionBean are dedicated to one client for entire life cycle.
1. Then how the instaces are served to the client?
2. Single instance is served to enire life cycle or the instance is swapped?
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
When a client invokes the create method on an statefull EJB home, it�s life cicle begins, the container than invokes newInstance() on the bean class, creating a new instance of it,then the container invokes setSessionContext and finally ejbCreate once the ejbCreate has finished the container than returns the ejb remote reference to the client.
About swap I think that it can be implemented and also some kind of pool using cache memory but that�s a vendor specific implementation, but one thing I think most vendors do is passivating the bean when the bean instance is not servicing methods from the client to preserve resources.
I agree. Here's the link:
subject: EJB-StatefulSessionBean
It's not a secret anymore!