avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: jakarta-avalon/src/java/org/apache/avalon/util/datasource JdbcConnectionPool.java
Date Fri, 06 Apr 2001 14:43:40 GMT
bloritsch    01/04/06 07:43:40

  Modified:    proposal/4.0/src/java/org/apache/avalon/datasource
                        JdbcConnectionPool.java
               src/java/org/apache/avalon/util/datasource
                        JdbcConnectionPool.java
  Log:
  When there are no available connections, JdbcConnectionPool now checks
  to see if the active connections are less than the max number of connections.
  If it is, then it creates a new connection.  This is to offset issues surrounding a
  down DB server.  The pool will no longer shrink to ablivion with no way of
  growing back.
  
  Revision  Changes    Path
  1.11      +12 -2     jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/datasource/JdbcConnectionPool.java
  
  Index: JdbcConnectionPool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/proposal/4.0/src/java/org/apache/avalon/datasource/JdbcConnectionPool.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- JdbcConnectionPool.java	2001/04/04 18:05:48	1.10
  +++ JdbcConnectionPool.java	2001/04/06 14:43:40	1.11
  @@ -26,7 +26,7 @@
    * thread to manage the number of SQL Connections.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.10 $ $Date: 2001/04/04 18:05:48 $
  + * @version CVS $Revision: 1.11 $ $Date: 2001/04/06 14:43:40 $
    */
   public class JdbcConnectionPool
       extends AbstractLoggable
  @@ -131,7 +131,17 @@
   
           if( 0 == m_ready.size() )
           {
  -            throw new SQLException("There are no more Connections available");
  +            if (m_active.size() < m_max)
  +            {
  +                obj = this.createJdbcConnection();
  +                m_lock.lock(m_active);
  +                m_active.add(obj);
  +                m_lock.unlock(m_active);
  +            }
  +            else
  +            {
  +                throw new SQLException("There are no more Connections available");
  +            }
           }
           else
           {
  
  
  
  1.12      +12 -2     jakarta-avalon/src/java/org/apache/avalon/util/datasource/JdbcConnectionPool.java
  
  Index: JdbcConnectionPool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon/src/java/org/apache/avalon/util/datasource/JdbcConnectionPool.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JdbcConnectionPool.java	2001/04/06 13:55:49	1.11
  +++ JdbcConnectionPool.java	2001/04/06 14:43:40	1.12
  @@ -26,7 +26,7 @@
    * thread to manage the number of SQL Connections.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.11 $ $Date: 2001/04/06 13:55:49 $
  + * @version CVS $Revision: 1.12 $ $Date: 2001/04/06 14:43:40 $
    */
   public class JdbcConnectionPool
       extends AbstractLoggable
  @@ -131,7 +131,17 @@
   
           if( 0 == m_ready.size() )
           {
  -            throw new SQLException("There are no more Connections available");
  +            if (m_active.size() < m_max)
  +            {
  +                obj = this.createJdbcConnection();
  +                m_lock.lock(m_active);
  +                m_active.add(obj);
  +                m_lock.unlock(m_active);
  +            }
  +            else
  +            {
  +                throw new SQLException("There are no more Connections available");
  +            }
           }
           else
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org


Mime
View raw message