Sandeep,

The idea is that you implement the HttpSessionBindingListener for any object
that you intend to store in your HttpSession object.  When the object is
removed from the HttpSession object, it will trigger a call to a method
called valueUnbound(HttpSessionBindingEvent event) which the object being
removed would have had to implement.  You can then use this as a means to do
some last second work before the object is removed from the HttpSession
object, typically cleanup work such as closing open data connections.

The nice thing is that the valueUnbound event is called even when a session
is timed out and consequently removes all the objects that were stored in
the session.  Typically you are not in control of triggering that event, so
wrapping an object so it implements the listener is both useful and
necessary in many cases.

What many people do is they create an object wrapper for an object that will
contain a data connection and have that object wrapper implement
HttpSessionBindingListener, so that they can cleanup data connections.  If
you have other external interactions in your system, the objects working
with those might also be good candidates for the same reason.

HTH,

Dan
--
Daniel Kirkdorffer
NACN IS: 425-580-6225
Sr. Consultant, Syllogistics LLC
Email: [EMAIL PROTECTED]
Web:   http://www.syllogistics.com/


> ----------
> From:         Sandeep Yarramreddy[SMTP:[EMAIL PROTECTED]]
> Reply To:     Sandeep Yarramreddy
> Sent:         Monday, November 22, 1999 5:00 PM
> To:   [EMAIL PROTECTED]
> Subject:      Question Regarding HttpSessionBindingListener.
>
> hi,
> has anyone used HttpSessionBindingListener class. I do not see any
> examples of
> its usage in the tutorial on suns web site. can some one please show an
> example of how to use it.
>
> Thanks in advance.
> Sandeep.
>
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> FAQs on JSP can be found at:
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to