aspose file tools*
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 Spring in Action this week in the Spring 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to close a session