Commons Dbcp
  1. Commons Dbcp
  2. DBCP-312

BasicDataSource.close() method needs JavaDoc clarification

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.1, 1.2.2
    • Fix Version/s: 1.3, 1.4
    • Labels:
      None

      Description

      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?

        Activity

        Glen Mazza created issue -
        Phil Steitz made changes -
        Field Original Value New Value
        Fix Version/s 1.4.1 [ 12314493 ]
        Phil Steitz made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Phil Steitz made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Phil Steitz made changes -
        Resolution Fixed [ 1 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Phil Steitz made changes -
        Fix Version/s 1.4 [ 12312615 ]
        Fix Version/s 1.3 [ 12311977 ]
        Fix Version/s 1.4.1 [ 12314493 ]
        Affects Version/s 1.2.2 [ 12311976 ]
        Affects Version/s 1.2.1 [ 12311975 ]
        Affects Version/s 1.3 [ 12311977 ]
        Phil Steitz made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Phil Steitz made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Glen Mazza
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development