Jason Hunter has a great example of using the HttpSessionBindingListener
interface.  This way you can create a method, which is automatically called
when a session is closed whether it's by physically closing it or when it
expires.
In this method you can return the session to a session pool to make sure
this really happens and you can also perform some clean up work.  His
example also does a rollback for any uncommitted transactions.
If you have the book (Java Servlet Programming 2nd Ed.) the code starts on page
290.

Matt

Quoting Brad Cox <[EMAIL PROTECTED]>:

> I've been storing JDBC connections from the connection pool in a named
> session attribute under the assumption that they would be automatically
> returned to the pool when the session expires. But on examining the code
> it
> now seems that they are just closed and deleted, thus draining the
> connection pool.
>
> Handling this manually when users log off explicitly is no problem. But
> how
> do I know when users just wander away? E.g. is there a way to be
> notified
> when sessions expire?
>
> How do others ensure that connections get returned to the pool?
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to