This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes How to close a session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How to close a session" Watch "How to close a session" New topic
Author

How to close a session

Abhishek Asthana
Ranch Hand

Joined: Sep 08, 2004
Posts: 146
Hi,
I have made a session using stateful session bean. Please tell me how to close the session when user logs out.
Thanks
Abhishek
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Handle the code in ejbRemove and make sure client calls remove before logging out. However if the client session expires, or the client loses the connection with the bean before calling remove, then you are still safe, because the container will first passivate the bean and later on will remove the bean calling ejbRemove anyway. As you can see you might not care about calling remove at all, but by doing so you give the container a hint that the SFSB could be discharged at any time.
Regards.


I think, therefore I exist -- Rene Descartes
 
 
subject: How to close a session
 
Similar Threads
Window session problem
session closed
need help: confused with session
Beginner trying to understand stale data
Should I close the session?