Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-468

Hardcoded value false for fastFailValidation on constructor

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1, 2.2.0
    • Fix Version/s: 2.2.0
    • Labels:
      None

      Description

      Debugging my code, i Found that fastFailValidation is always false because of this Constructor:

      org.apache.commons.dbcp2.PoolableConnection
          /**
          *
          * @param conn my underlying connection
          * @param pool the pool to which I should return when closed
          * @param jmxName JMX name
          */
         public PoolableConnection(Connection conn,
                 ObjectPool<PoolableConnection> pool, ObjectName jmxName) {
             this(conn, pool, jmxName, null, false);
         }
      

      Notice that 4th and 5th params are for fastFailValidation. It will always be false. (and null for sql codes)

      My Pool definition (spring):

       <bean id="dataSource" class="org.apache.commons.dbcp2.managed.BasicManagedDataSource" destroy-method="close">
         <property name="transactionManager" ref="jbossTransactionManager"/>
          <property name="driverClassName" value="xxx" />
          <property name="url" value="xxx" />
          <property name="username" value="xxx" />
          <property name="password" value="xxx" />
          <property name="initialSize" value="0" />
          <property name="defaultAutoCommit" value="false" />
          <property name="maxTotal" value="1" />
          <property name="maxIdle" value="0" />
          <property name="maxWaitMillis" value="5000" />
          <property name="testOnBorrow" value="true" />
          <property name="testOnReturn" value="false" />
          <property name="fastFailValidation" value="true" />
          <property name="validationQuery" value="select 1 go" />
       </bean>
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              lagar84 Euclides M
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: