File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes State of Stateful Session Beans 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 "State of Stateful Session Beans" Watch "State of Stateful Session Beans" New topic

State of Stateful Session Beans

Dhananjay Ghanwat

Joined: Dec 23, 2002
Posts: 27
How is the state of the Stateful session bean maintained. Like how an HttpSession can be maintained using URL rewriting or cookies.
Similary how does EJB container identifies the Stateful Session Bean for a unique client.

Also what would be the timeout period for a Stateful Session Bean.

Thank you
Dhananjay G.
Ramakrishnan thiyagarajan
Ranch Hand

Joined: Oct 07, 2003
Posts: 57
EJBcontainer maintains the stateful session bean state.if any webbased clinet accesses EJB the EJBclient session is maintained by HTTPsession.if the session period is out, container maintains a beans state.
Dhananjay Ghanwat

Joined: Dec 23, 2002
Posts: 27
Thanks Ramakrishnan,

I would like to know the concept of how does the EJB Container manages the state.

Stan Sokolov
Ranch Hand

Joined: Apr 13, 2004
Posts: 120

The biggest difference between the stateful session bean and the other bean types is that stateful session beans don't use instance pooling. Stateful session beans are dedicated to one client for their entire life, so there is no swapping or pooling of instances.[12] Instead of pooling instances, stateful session beans are simply evicted from memory to conserve resources. The EJB object remains connected to the client, but the bean instance is dereferenced and garbage collected during inactive periods. This means that a stateful bean must be passivated before it is evicted to preserve the conversational state of the instance, and it must be activated to restore the state when the EJB object becomes active again.

[12] Some vendors use pooling with stateful session beans, but that is a proprietary implementation and shouldn't impact the specified life cycle of the stateful session bean.

Good luck for yourself.
I agree. Here's the link:
subject: State of Stateful Session Beans
jQuery in Action, 3rd edition