commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject cvs commit: jakarta-commons/dbcp/src/java/org/apache/commons/dbcp BasicDataSource.java
Date Sat, 20 Sep 2003 17:31:05 GMT
dirkv       2003/09/20 10:31:05

  Modified:    dbcp/src/java/org/apache/commons/dbcp BasicDataSource.java
  Log:
  Bugzilla Bug 23291
    impossible to turn off all validation tests when a validationQuery is present
  
  Revision  Changes    Path
  1.28      +13 -10    jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/BasicDataSource.java
  
  Index: BasicDataSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/BasicDataSource.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- BasicDataSource.java	20 Sep 2003 17:11:25 -0000	1.27
  +++ BasicDataSource.java	20 Sep 2003 17:31:05 -0000	1.28
  @@ -265,7 +265,7 @@
        * borrowed from the pool.  If the object fails to validate, it will be
        * dropped from the pool, and we will attempt to borrow another.
        */
  -    protected boolean testOnBorrow = GenericObjectPool.DEFAULT_TEST_ON_BORROW;
  +    protected boolean testOnBorrow = true;
   
       public boolean getTestOnBorrow() {
           return this.testOnBorrow;
  @@ -279,7 +279,7 @@
        * The indication of whether objects will be validated before being
        * returned to the pool.
        */
  -    protected boolean testOnReturn =  GenericObjectPool.DEFAULT_TEST_ON_RETURN;
  +    protected boolean testOnReturn = false;
   
       public boolean getTestOnReturn() {
           return this.testOnReturn;
  @@ -343,7 +343,7 @@
        * evictor (if any).  If an object fails to validate, it will be dropped
        * from the pool.
        */
  -    protected boolean testWhileIdle = GenericObjectPool.DEFAULT_TEST_WHILE_IDLE;
  +    protected boolean testWhileIdle = false;
   
       public boolean getTestWhileIdle() {
           return this.testWhileIdle;
  @@ -742,6 +742,13 @@
               throw new SQLNestedException(message, t);
           }
   
  +        // Can't test without a validationQuery
  +        if (validationQuery == null) {
  +            setTestOnBorrow(false);
  +            setTestOnReturn(false);
  +            setTestWhileIdle(false);
  +        }
  +
           // Create an object pool to contain our active connections
           if ((abandonedConfig != null) && (abandonedConfig.getRemoveAbandoned()
== true)) {
               connectionPool = new AbandonedObjectPool(null,abandonedConfig);
  @@ -760,10 +767,6 @@
           connectionPool.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
           connectionPool.setTestWhileIdle(testWhileIdle);
           
  -        if (validationQuery != null && !testOnReturn && !testWhileIdle)
{
  -            connectionPool.setTestOnBorrow(true);
  -        }
  -
           // Set up statement pool, if desired
           GenericKeyedObjectPoolFactory statementPoolFactory = null;
           if (isPoolPreparedStatements()) {
  
  
  

Mime
View raw message