• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to disconnect resources if user logout unnormally?

 
krussi rong
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a problem about how to disconnect the
database,something like that when the user doesn't
log out by clicking on a logout button, but just
closes the brower?
what can I do in my jsp?
thanks
Krussi
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you have a session associated with the user, you can implement the HttpSessionBindingListener interface and get notified when the servlet container finally times out the session and destroys it.
By using a connection pool instead of trying to manage db connections yourself, you can save a lot of trouble. You have to ensure that no matter what happens in your servlet/JSP the connection is returned to the pool manager.
Bill
 
krussi rong
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,

If I have a session associated with the user, and implement the HttpSessionBindingListener interface and get notified when the servlet container finally times out the session and destroys it.
So we also have to wait for the times out the
session, is there any way to do close resources
right away?
Krussi
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!