• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to disconnect resources if user logout unnormally?

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic