You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Euclides M (JIRA)" <ji...@apache.org> on 2016/08/03 17:40:20 UTC

[jira] [Updated] (DBCP-468) Hardcoded value false for fastFailValidation on constructor

     [ https://issues.apache.org/jira/browse/DBCP-468?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Euclides M updated DBCP-468:
----------------------------
    Description: 
Debugging my code, i Found that fastFailValidation is always false because of this Constructor:

{code:title=org.apache.commons.dbcp2.PoolableConnection|borderStyle=solid}
    /**
    *
    * @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);
   }
{code}

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

My Pool definition (spring):

{code:xml}
 <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>
{code}

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

{code:title=org.apache.commons.dbcp2.PoolableConnection|borderStyle=solid}
    /**
    *
    * @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);
   }
{code}

Notice that 4th and 5th params are for fastFailValidation. It will always be false.

My Pool definition (spring):

{code:xml}
 <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>
{code}


> Hardcoded value false for fastFailValidation on constructor
> -----------------------------------------------------------
>
>                 Key: DBCP-468
>                 URL: https://issues.apache.org/jira/browse/DBCP-468
>             Project: Commons Dbcp
>          Issue Type: Bug
>    Affects Versions: 2.2, 2.1.1
>            Reporter: Euclides M
>
> Debugging my code, i Found that fastFailValidation is always false because of this Constructor:
> {code:title=org.apache.commons.dbcp2.PoolableConnection|borderStyle=solid}
>     /**
>     *
>     * @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);
>    }
> {code}
> Notice that 4th and 5th params are for fastFailValidation. It will always be false. (and null for sql codes)
> My Pool definition (spring):
> {code:xml}
>  <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>
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)