Author: psteitz Date: Sun Mar 12 21:13:24 2006 New Revision: 385425 URL: http://svn.apache.org/viewcvs?rev=385425&view=rev Log: Documented fact that true values for testOnBorrow, testOnReturn, testWhileIdle only have effect when validationQuery is set to a non-null string. Addresses BZ #36799 Reported by Douglas Squirrel
Modified: jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/BasicDataSource.java jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.java jakarta/commons/proper/dbcp/trunk/xdocs/configuration.xml Modified: jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/BasicDataSource.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/BasicDataSource.java?rev=385425&r1=385424&r2=385425&view=diff ============================================================================== --- jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/BasicDataSource.java (original) +++ jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/BasicDataSource.java Sun Mar 12 21:13:24 2006 @@ -267,6 +267,14 @@ return this.testOnBorrow; } + /** + * Sets the <code>testOnBorrow</code> property. This property determines + * whether or not the pool will validate objects before they are borrowed + * from the pool. For a <code>true</code> value to have any effect, the + * <code>validationQuery</code> property must be set to a non-null string. + * + * @param testOnBorrow new value for testOnBorrow property + */ public synchronized void setTestOnBorrow(boolean testOnBorrow) { this.testOnBorrow = testOnBorrow; if (connectionPool != null) { @@ -284,6 +292,14 @@ return this.testOnReturn; } + /** + * Sets the <code>testOnReturn</code> property. This property determines + * whether or not the pool will validate objects before they are returned + * to the pool. For a <code>true</code> value to have any effect, the + * <code>validationQuery</code> property must be set to a non-null string. + * + * @param testOnReturn new value for testOnReturn property + */ public synchronized void setTestOnReturn(boolean testOnReturn) { this.testOnReturn = testOnReturn; if (connectionPool != null) { @@ -360,6 +376,14 @@ return this.testWhileIdle; } + /** + * Sets the <code>testWhileIdle</code> property. This property determines + * whether or not the idle object evictor will validate connections. For a + * <code>true</code> value to have any effect, the + * <code>validationQuery</code> property must be set to a non-null string. + * + * @param testWhileIdle new value for testWhileIdle property + */ public synchronized void setTestWhileIdle(boolean testWhileIdle) { this.testWhileIdle = testWhileIdle; if (connectionPool != null) { Modified: jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.java?rev=385425&r1=385424&r2=385425&view=diff ============================================================================== --- jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.java (original) +++ jakarta/commons/proper/dbcp/trunk/src/java/org/apache/commons/dbcp/datasources/InstanceKeyDataSource.java Sun Mar 12 21:13:24 2006 @@ -419,7 +419,9 @@ * before being returned by the {*link #borrowObject} * method. If the object fails to validate, * it will be dropped from the pool, and we will attempt - * to borrow another. + * to borrow another. For a <code>true</code> value to have any effect, + * the <code>validationQuery</code> property must be set to a non-null + * string. * * @see #getTestOnBorrow */ @@ -452,7 +454,9 @@ * When <tt>true</tt>, objects will be * {*link PoolableObjectFactory#validateObject validated} * before being returned to the pool within the - * {*link #returnObject}. + * {*link #returnObject}. For a <code>true</code> value to have any effect, + * the <code>validationQuery</code> property must be set to a non-null + * string. * * @see #getTestOnReturn */ @@ -566,7 +570,10 @@ * When <tt>true</tt>, objects will be * {*link PoolableObjectFactory#validateObject validated} * by the idle object evictor (if any). If an object - * fails to validate, it will be dropped from the pool. + * fails to validate, it will be dropped from the pool. For a + * <code>true</code> value to have any effect, + * the <code>validationQuery</code> property must be set to a non-null + * string. * * @see #getTestWhileIdle * @see #setTimeBetweenEvictionRunsMillis Modified: jakarta/commons/proper/dbcp/trunk/xdocs/configuration.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/dbcp/trunk/xdocs/configuration.xml?rev=385425&r1=385424&r2=385425&view=diff ============================================================================== --- jakarta/commons/proper/dbcp/trunk/xdocs/configuration.xml (original) +++ jakarta/commons/proper/dbcp/trunk/xdocs/configuration.xml Sun Mar 12 21:13:24 2006 @@ -179,7 +179,10 @@ <td> The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be - dropped from the pool, and we will attempt to borrow another. + dropped from the pool, and we will attempt to borrow another.<br/> + <strong>NOTE</strong> - for a <code>true</code> value to have any effect, + the <code>validationQuery</code> parameter must be set to a non-null + string. </td> </tr> <tr> @@ -187,7 +190,9 @@ <td>false</td> <td> The indication of whether objects will be validated before being - returned to the pool. + returned to the pool. <br/> <strong>NOTE</strong> - for a + <code>true</code> value to have any effect, the + <code>validationQuery</code> parameter must be set to a non-null string. </td> </tr> <tr> @@ -196,7 +201,9 @@ <td> The indication of whether objects will be validated by the idle object evictor (if any). If an object fails to validate, it will be dropped - from the pool. + from the pool. <br/> <strong>NOTE</strong> - for a <code>true</code> + value to have any effect, the <code>validationQuery</code> parameter + must be set to a non-null string. </td> </tr> <tr> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]