Hello Folks, Stateful Session Bean will maintain conversational state between the method invocations.If so,I would like to know whether the conversation state will be maintained by bean itself or through container.Please throw some light abt this. Regards, Ravi
A little bit of both... the bean instance will store the conversational state but the Container will manage the bean instance. Therefore, if the Container needs to do some memory gymnastics then it will swap the bean instances (including session state) to and from persistance storage. The actual details on the storage (be it the file system, a database, etc.) are vendor specific.
hi all, i think state will be maintained with Bean , managed by the container, using EJBContext... think about in this way, suppose between the lulls, your bean get passivated...and container will save the state to some other media along with the context of bean...now the bean (instance) is free from resources and may be ready to server other clients... now again the previous client comes.. this time the bean will be activated and restored its previous state.. so all("Bean(instance)+ BeanContext + Container") are responsible to maintain the converstaional state.. Hope this may help
Originally posted by Naveen Sharma: now the bean (instance) is free from resources and may be ready to server other clients... now again the previous client comes.. this time the bean will be activated and restored its previous state..
While it is technically possible, no EJB Container that I know of actually pools instances for Stateful Session Beans.
hi, what i think is to limit the number of stateful beans instances in memory, the container can swap out stateful bean , saving its conversational state to a hard disk or other storage ("Passivation").. After passivation a stateful bean, the conversation state is safely stored away, along with the resources being used... when the original clients invokes a method, the passivated conversational state is swapped in to a bean("Activation").. this bean now resumes the conversation with the original client... It shud be noted that the bean receives the activated state may not be the original bean instance.. Thus EJB does indeed support the effect of pooling stateful beans. only a few instance can be in memory, when there are many clients As the session context(EJB Context) remains associated with the instance for the lifetime of the instance.. and if the instances are swapping to serve clients while(Passivation/Activation)... their context do come into the picture correct me if i am wrong Naveen