Jeetandra,

When the user closes his (or her) browser, nothing happens.  It doesn't
send any dying message back to the web server to say it's closing,
please take care of my session (and feed the dog).  Although, I have
seen info on this group about how that can be done in client-side
JavaScript.

So, in this situation (when the browser was closed), the only way the
session will become invalidated is when (if) it times out.  Thus, my
previous message about ensuring that the session timeout is set to a
useful value.

Note, if you are planning on storing your JDBC Connection in the session
scope, you may want to investigate the HttpSessionBindingListener
interface.  You can use this mechanism to have some of your code
executed when the session is invalidated (either explicity or via the
timeout), which can then close any open JDBC resultsets, statements and
the connection itself.

There is a commonly-held belief that some JDBC drivers can leak
resources if you do not explicitly close these objects.  I'm not sure
how true it is, but it seems like good programming practice anyway.

Regards

Drew Cox
Barrack Consulting


        -----Original Message-----
        From:   Jeetandra Mahtani [SMTP:[EMAIL PROTECTED]]
        Sent:   Tuesday, November 23, 1999 10:31 PM
        To:     [EMAIL PROTECTED]
        Subject:        Re: Connections in sessions...

        Drew,
        Thanks for replying. Once I establish connection, I am storing
the connection in a session.
        So if a user closes his browser, would the session be
invalidated and the connection that
        was stored in it?
        Thank,s
        J

        --- Drew Cox <[EMAIL PROTECTED]> wrote:
        > Also note that, depending on the servlet container and version
you are
        > using, the http session timeout might default to "never
timeout".  This
        > is the case with the JSWDK 1.0.  You have to explicitly set it
by
        > calling the HttpSession.setMaxInactiveInterval(int interval)
method on
        > your session object.
        >
        > Drew
        >
        >         -----Original Message-----
        >         From:   Jim Richards [SMTP:[EMAIL PROTECTED]]
        >         Sent:   Tuesday, November 23, 1999 11:10 AM
        >         To:     [EMAIL PROTECTED]
        >         Subject:        Re: Connections in sessions...
        >
        >         The java session stays active until it times out,
because each
        > time you hit a page
        >         a new http conenction is created, and the servlet
engine will
        > associate the
        >         current java session with the new http session based
on a cookie
        >         or other attribute that identifies them. The Java
session will
        > usually time out if
        >         it does not detect a http connection from its user.
        >
        >         have a look at HttpSessionBindingListener and
        > HttpSessionBindingEvent as these
        >         will allow you to catch when the java session times
out, and
        > lets you run
        >         any cleanup code you need.
        >
        >
        >         At 02:41 PM 22/11/99 -0800, you wrote:
        >         >Hello-
        >         >I am currently connecting to an AS/400 by using IBM's
as400
        > jdbc access class.
        >         >Once a user logs into the system, I store that
connection in a
        > session
        >         >and use it for all the transaction's the user
completes. Now,
        > when a
        >         >connection is established, I see a job running on the
as400 for
        > that
        >         >user. Fine. When the user clicks the logout button, I
        > invalidate the
        >         >session and there are no more jobs running for that
user on the
        > 400.
        >         >But if the user closes the browser without clicking
the logout
        > button,
        >         >the job remains on the 400 and doesn't end. Is there
something
        > that
        >         >I am doing wrong or missing. I would appreciate it if
someone
        > could
        >         >give me some ideas/tips. Thank you.
        >         >J
        >
        >
        >         --
        >         Subvert the dominant paradigm
        >          http://www.cyber4.org/members/grumpy/index.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
        >
        >
________________________________________________________________________
___
        > 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
        >

        __________________________________________________
        Do You Yahoo!?
        Bid and sell for free at http://auctions.yahoo.com

===========================================================================
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