Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@www.apache.org Received: (qmail 96265 invoked from network); 24 Nov 2003 05:06:00 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 24 Nov 2003 05:06:00 -0000 Received: (qmail 28392 invoked by uid 500); 24 Nov 2003 05:05:21 -0000 Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 28375 invoked by uid 500); 24 Nov 2003 05:05:20 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 28362 invoked from network); 24 Nov 2003 05:05:20 -0000 Received: from unknown (HELO hotmail.com) (64.4.18.206) by daedalus.apache.org with SMTP; 24 Nov 2003 05:05:20 -0000 Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Sun, 23 Nov 2003 21:05:31 -0800 Received: from 61.11.77.212 by law12-oe71.law12.hotmail.com with DAV; Mon, 24 Nov 2003 05:05:31 +0000 X-Originating-IP: [61.11.77.212] X-Originating-Email: [antonypaul24@hotmail.com] From: "Antony Paul" To: "Tomcat Users List" References: <3FBE1656.9060408@comcast.net> Subject: Re: Severity less - DBCP not closing connection. Date: Mon, 24 Nov 2003 10:41:53 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4927.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4927.1200 Message-ID: X-OriginalArrivalTime: 24 Nov 2003 05:05:31.0429 (UTC) FILETIME=[95A19550:01C3B248] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Thanks a lot for the info. I need more explanation. I thought that Tomcat creates a new thread to serve the new request and continues execution of the current servlet thread after a forward() or redirect(). Now you mean that only after the forward() method is completed the control returns to the calling servlet.. If the servlet to which it is forwareded takes lot of time to complete then what will happen ?. This is not mentioned in any articles or books that I have read. Antony Paul. ----- Original Message ----- From: "Christopher Schultz" To: "Tomcat Users List" Sent: Friday, November 21, 2003 7:12 PM Subject: Re: Severity less - DBCP not closing connection. > Antony, > > I have seen DBCP not closing a connection if the request is forwarded to > > same page in the try block before the request is forwarded. With > > sendRedirect no problem. > > If you execute a "forward", then it acts just like a method call -- your > connection will still be absent from the pool. When you forward, you > exit your try/catch block before the browser makes the next request. > > You have to do your code like this: > > try > { > conn = ...; > } > catch (...) > { > } > finally > { > conn.close(); > } > > requestDispatcher.forward(...); > ======================================== > > Otherwise you might deadlock your application. > > > I work with one connection to test for connection leak and any bottlenecks > > in code. > > This is a very good idea. > > > It works fine if I put the forward() after the end of finally > > block. I want to know whether it is bug or config error or Tomcat behaves > > so. > > This is a logic error - not a Tomcat bug or config error. You just have > to write more careful code. > > -chris > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: tomcat-user-help@jakarta.apache.org