Can i suggest something ?

        Logic is something like this ...

        initiate a thread in the init() of the servlet

                in the doGet( ... ) and in the doPost( ... ) when you open
the database set a flag imme. to indicate an open database connection.

                when you close the database set the flag to false imme.

                now if the user presses the stop button ...
                let the thread check at a specific time interval to see if
the database is open ( using the flag ) ...
                if yes let the thread close the connection....


        distroy  the created thread in destroy() of the servelet

        how is that ?
        Since the thread is created in the init it is bound to run ( scan
the flag ) at specific interval of time .....
        SO even if the user cliks the stop button the open database
connecition will be close by the thread ...


Regards
guru

-----Original Message-----
From: Jeremy W. Redmond [mailto:[EMAIL PROTECTED]]
Sent: 18 July 2002 13:13
To: [EMAIL PROTECTED]
Subject: Database connections when user hits "stop" in browser..(in)


I couldn't find an answer to this question in archives.  Maybe there is no
solution.

In testing I have noticed that if a user runs a servlet that does some
database access and hits "stop" (the X in IE for example) while the database
connection is still open, then the database connection remains open.  This
will eventually cause problems if we have 100+ users and say 25% of them do
this often.

Is there anyway for me to clean these up on a regular basis?
Better yet, can I somehow close the connection right away?

Since the connection is established in the servlet's doGet( ) method,
connections will keep being opened.

Thanks in advance for any advice.

___________________________________________________________________________
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