• Post Reply Bookmark Topic Watch Topic
  • New Topic

How Session Bean maintains its session.  RSS feed

 
Kannan Kuppannan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have a doubt regarding the stateful session bean. Correct me
if my understanding is wrong.
Statefull session bean have activate and passivate methods. Hope u know the need for that. When i execute passivate method, the ejb
container will store the session details in storage(memory or hard
disk ,vary based on vendors). By the same way if i execute activate
method, the container get the session for me from the storage.
My doubt here is how the container keep track of this user
information.How it is maintaining the session for the user and how
its identifying the stateful session object.
My understanding is thru cookies or URL rewriting.....
DO U HAVE ANY ANSWERS???
Thanks,
Prem
 
Nagendra Prasad
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Prem..
I am not sure if u have access to the O'reilly book on Enterprise Java Beans. In the book which covered ejb 1.1, the explanation u seek is on pg. 55. Its a bit lengthy.. so i am taking this short cut..
if u dont have the book, let me know.. i shall make the effort of typing the pages out!
Prasad.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, it's the EJB Container that calls ejbActivate() and ejbPassivate(), not you. The EJB Container may at some point decide that a particular SessionBean instance it not going to be used for a while and that it can be passivated to disk. The EJB Container again activates the instance when the instance receives a method call.
The EJB Container associates method calls to particular SessionBean instances based on RMI object references. The client has an RMI stub of the EJB and when she makes an invocation, the stub knows how to communicate with the EJB Container and let it know which EJB instance this particular reference refers to. If you happen to know CORBA's IORs, this is exactly the same thing.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This topic actually comes up quite frequently around here. You may find these two posts helpful:
Stateful Session Bean question
Question on Statefull Session bean
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!