Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 67125 invoked from network); 23 Dec 2009 00:09:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Dec 2009 00:09:57 -0000 Received: (qmail 40283 invoked by uid 500); 23 Dec 2009 00:09:56 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 40179 invoked by uid 500); 23 Dec 2009 00:09:56 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 40169 invoked by uid 99); 23 Dec 2009 00:09:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Dec 2009 00:09:56 +0000 X-ASF-Spam-Status: No, hits=-10.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Dec 2009 00:09:49 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6945D234C045 for ; Tue, 22 Dec 2009 16:09:29 -0800 (PST) Message-ID: <871215619.1261526969417.JavaMail.jira@brutus> Date: Wed, 23 Dec 2009 00:09:29 +0000 (UTC) From: "Glen Mazza (JIRA)" To: issues@commons.apache.org Subject: [jira] Commented: (DBCP-312) BasicDataSource.close() method needs JavaDoc clarification In-Reply-To: <1502255147.1261017258249.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DBCP-312?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12793845#action_12793845 ] Glen Mazza commented on DBCP-312: --------------------------------- What you've written above is absolute music to my ears, and would be excellent to replace what you presently have in the JavaDoc. I have a main program that launches many threads, each requesting/returning a connection. The main thread then closes the connection pool and exits while several of the threads may still be running. This means (1) those threads can still work with their live connection even though the main thread closed the pool, and (2) once each spawned thread is finished and closes its connection, it becomes a "real" close of the underlying JDBC connection. Great to hear. Thanks! > BasicDataSource.close() method needs JavaDoc clarification > ---------------------------------------------------------- > > Key: DBCP-312 > URL: https://issues.apache.org/jira/browse/DBCP-312 > Project: Commons Dbcp > Issue Type: Bug > Affects Versions: 1.3 > Reporter: Glen Mazza > Priority: Minor > > Hello, the JavaDoc could use clarification for the BasicDataSource.close() method. > Link: http://commons.apache.org/dbcp/apidocs/org/apache/commons/dbcp/BasicDataSource.html#close() > Text: "Close and release all connections that are currently stored in the connection pool associated with our data source. All open (active) connection remain open until closed. Once the data source has been closed, no more connections can be obtained." > I'm unsure if this method closes just idle, or both idle and active connections. This is a important distinction, because you wouldn't want to call close() if you still have some needed active connections open on various threads. The first sentence seems to indicate both active and idle threads will be closed, but the second sentence indicates that only the idle threads will be explicitly closed. > Recommend changing text to: > "Close and release all connections, whether active or idle, that are currently stored in the connection pool associated with our data source. Once the data source has been closed, no more connections can be obtained." > or (if this method closes just idle connections): > "Close and release all idle connections that are currently stored in the connection pool associated with our data source. All open (active) connections will still remain open until they are closed via the Connection close() method. Once the data source has been closed, no more connections can be obtained." > Note that, for the latter case, if BasicDataSource.close() only closes and releases idle connections, and an active DBCP Connection object subsequently has its close() method called, it's not clear whether its underlying actual JDBC connection will be released. I.e., how do you release JDBC connections on previously active DBCP Connections after BasicDataSource.close() is called? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.