Hi,
I have made a shopping cart where user has to login. I have used stateful session bean to manage the session. Now the problem is that even after shutting down computer, the user is not getting logged off.
Please tell me how to kill a session when user logs out or system is shut down.
I am using JBoss 3.2.1
Abhishek.
-
How to close a session (2 messages)
- Posted by: Abhishek Asthana
- Posted on: March 14 2005 05:15 EST
Threaded Messages (2)
- How to close a session by Martin Straus on March 14 2005 10:02 EST
- How to close a session by Matan Amir on March 14 2005 10:28 EST
-
How to close a session[ Go to top ]
- Posted by: Martin Straus
- Posted on: March 14 2005 10:02 EST
- in response to Abhishek Asthana
What kind of "session" are you talking about? The application session, or the statefull session?
In the latter case, the session must be removed with session.remove(). You can achieve this implementing a session listener that gets notified when the user's session expires, and performs the removal.
In the case of a non-web client, where the application can be killed in many ways (unplugging the users PC, for instance), you may not have any chance to detect that situation; the container should detect this (the client that created a statefull session is not there anymore). I guess this should be somewhere in the EJB spec, but I don't quite remember...
Cheers and happy coding,
Martin -
How to close a session[ Go to top ]
- Posted by: Matan Amir
- Posted on: March 14 2005 10:28 EST
- in response to Martin Straus
Adding to Martin's response, if you have a non-web client you could just follow the idea of web sessions - set an expiration on session.
Have a session manager that monitors the open sessions and test them for inactivity.