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 AbandonedObjectPool.java
Date Tue, 30 Sep 2003 20:50:29 GMT
dirkv       2003/09/30 13:50:29

  Modified:    dbcp/src/java/org/apache/commons/dbcp
                        AbandonedObjectPool.java
  Log:
  Bugzilla Bug 22776: DBCP should not be writing messages to stderr or stdout
  - Do not print error messages in borrowObject (allow exceptions to pass)
  
  Revision  Changes    Path
  1.11      +17 -27    jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/AbandonedObjectPool.java
  
  Index: AbandonedObjectPool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/dbcp/src/java/org/apache/commons/dbcp/AbandonedObjectPool.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AbandonedObjectPool.java	26 Sep 2003 12:45:13 -0000	1.10
  +++ AbandonedObjectPool.java	30 Sep 2003 20:50:29 -0000	1.11
  @@ -61,11 +61,9 @@
   
   package org.apache.commons.dbcp;
   
  -import java.sql.SQLException;
   import java.util.ArrayList;
   import java.util.Iterator;
   import java.util.List;
  -import java.util.NoSuchElementException;
   
   import org.apache.commons.pool.PoolableObjectFactory;
   import org.apache.commons.pool.impl.GenericObjectPool;
  @@ -112,30 +110,22 @@
        * @return Object jdbc Connection
        */
       public Object borrowObject() throws Exception {
  -        try {
  -            if (config != null
  -                    && config.getRemoveAbandoned()
  -                    && (getNumIdle() < 2)
  -                    && (getNumActive() > getMaxActive() - 3) ) {
  -                removeAbandoned();
  -            }
  -            Object obj = super.borrowObject();
  -            if(obj instanceof AbandonedTrace) {
  -                ((AbandonedTrace)obj).setStackTrace();
  -            }
  -            if (obj != null && config != null && config.getRemoveAbandoned())
{
  -                synchronized(trace) {
  -                    trace.add(obj);
  -                }
  +        if (config != null
  +                && config.getRemoveAbandoned()
  +                && (getNumIdle() < 2)
  +                && (getNumActive() > getMaxActive() - 3) ) {
  +            removeAbandoned();
  +        }
  +        Object obj = super.borrowObject();
  +        if(obj instanceof AbandonedTrace) {
  +            ((AbandonedTrace)obj).setStackTrace();
  +        }
  +        if (obj != null && config != null && config.getRemoveAbandoned())
{
  +            synchronized(trace) {
  +                trace.add(obj);
               }
  -            return obj;
  -        } catch(NoSuchElementException ne) {
  -            throw new SQLException(
  -                "DBCP could not obtain an idle db connection, pool exhausted");
  -        } catch(Exception e) {
  -            System.out.println("DBCP borrowObject failed: " + e.getMessage());
  -            throw e;
           }
  +        return obj;
       }
   
       /**
  
  
  

Mime
View raw message