Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding Stateful Session Bean!!

 
Ravi Kumar Ravuru
Ranch Hand
Posts: 176
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Gurumurthy Ramamurthy
Ranch Hand
Posts: 273
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container, of course. The details about the session bean (stateless or stateful) are provided by you in the deployment descriptor, which is mainly for the container's information.
Cheers,
Guru
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The conversational state will be stored in bean.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Naveen Sharma
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think state will be maintained with Bean , managed by the container, using EJBContext...

What has the EJBContext got to do with this?

...now the bean (instance) is free from resources and may be ready to server other clients...

I am not sure about this one though.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Naveen Sharma
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thus EJB does indeed support the effect of pooling stateful beans. only a few instance can be in memory, when there are many clients

I DONT KNOW ANY CONTAINER WHICH DOES THAT.
When pooling does is not done:
The bean instance are destroyed after its state is passivated.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic