avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: avalon-excalibur/datasource/src/java/org/apache/avalon/excalibur/datasource JdbcConnectionPool.java ResourceLimitingJdbcDataSource.java
Date Mon, 31 Mar 2003 18:32:55 GMT
bloritsch    2003/03/31 10:32:55

  Modified:    datasource build.xml default.properties
               datasource/src/java/org/apache/avalon/excalibur/datasource
                        JdbcConnectionPool.java
                        ResourceLimitingJdbcDataSource.java
  Log:
  I can't get HSQL to work, although with a real DB it works
  
  Revision  Changes    Path
  1.43      +7 -11     avalon-excalibur/datasource/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/datasource/build.xml,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- build.xml	31 Mar 2003 16:23:14 -0000	1.42
  +++ build.xml	31 Mar 2003 18:32:54 -0000	1.43
  @@ -277,24 +277,16 @@
           <echo message="Performing Unit Tests" />
   
           <mkdir dir="${build.tests}"/>
  -        <!--
           <parallel>
             <sequential>
               <java fork="true" classname="org.hsqldb.Server">
                   <classpath refid="test.class.path"/>
               </java>
  -            <waitfor maxwait="5" maxwaitunit="minute">
  -              <available file="test.done"/>
  -            </waitfor>
  -            <java fork="true" classname="org.hsqldb.Server">
  -                <classpath refid="test.class.path"/>
  -            </java>
             </sequential>
             <sequential>
               <waitfor maxwait="30" maxwaitunit="second">
                 <available file="test.data"/>
               </waitfor>
  -            -->
               <junit fork="true"
                      haltonfailure="${junit.failonerror}"
                      printsummary="yes"
  @@ -318,10 +310,14 @@
                   </fileset>
                 </batchtest>
               </junit>
  -            <echo file="test.done" append="false">done</echo>
  -            <!--
  +            <sql driver="${test.jdbc.driver}"
  +                    url="${test.jdbc.url}"
  +                    user="${test.jdbc.user}"
  +                    password="${test.jdbc.password}">
  +                SHUTDOWN;
  +            </sql>
             </sequential>
  -  </parallel> -->
  +        </parallel>
           <delete>
             <fileset dir="." includes="test.*"/>
           </delete>
  
  
  
  1.24      +2 -2      avalon-excalibur/datasource/default.properties
  
  Index: default.properties
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/datasource/default.properties,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- default.properties	31 Mar 2003 16:23:14 -0000	1.23
  +++ default.properties	31 Mar 2003 18:32:54 -0000	1.24
  @@ -67,10 +67,10 @@
   
   test.jdbc.driver.jar=lib/hsqldb-1.7.1.jar
   test.jdbc.driver=org.hsqldb.jdbcDriver
  -test.jdbc.url=jdbc:hsqldb:.
  +test.jdbc.url=jdbc:hsqldb:hsql://localhost
   test.jdbc.user=SA
   test.jdbc.password=
  -test.jdbc=true
  +skip.tests=true
   
   # --------------------------------------------------
   
  
  
  
  1.24      +8 -4      avalon-excalibur/datasource/src/java/org/apache/avalon/excalibur/datasource/JdbcConnectionPool.java
  
  Index: JdbcConnectionPool.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/datasource/src/java/org/apache/avalon/excalibur/datasource/JdbcConnectionPool.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- JdbcConnectionPool.java	25 Mar 2003 21:34:01 -0000	1.23
  +++ JdbcConnectionPool.java	31 Mar 2003 18:32:55 -0000	1.24
  @@ -70,6 +70,7 @@
       extends HardResourceLimitingPool
       implements Runnable, Disposable, Initializable
   {
  +    private Exception m_cause = null;
       private Thread m_initThread;
       private final boolean m_autoCommit;
       private boolean m_noConnections;
  @@ -85,7 +86,7 @@
       {
           super( factory, controller, max );
           m_min = min;
  -
  +        m_initialized = false;
           m_autoCommit = autoCommit;
       }
   
  @@ -167,6 +168,8 @@
           {
               if( m_noConnections )
               {
  +                if (m_cause != null) throw m_cause;
  +                
                   throw new IllegalStateException( "There are no connections in the pool,
check your settings." );
               }
               else if( m_initThread == null )
  @@ -257,9 +260,10 @@
           }
           catch( Exception e )
           {
  -            if( getLogger().isDebugEnabled() )
  +            m_cause = e;
  +            if( getLogger().isWarnEnabled() )
               {
  -                getLogger().debug( "Caught an exception during initialization", e );
  +                getLogger().warn( "Caught an exception during initialization", e );
               }
           }
       }
  
  
  
  1.5       +8 -4      avalon-excalibur/datasource/src/java/org/apache/avalon/excalibur/datasource/ResourceLimitingJdbcDataSource.java
  
  Index: ResourceLimitingJdbcDataSource.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/datasource/src/java/org/apache/avalon/excalibur/datasource/ResourceLimitingJdbcDataSource.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ResourceLimitingJdbcDataSource.java	27 Feb 2003 15:20:55 -0000	1.4
  +++ ResourceLimitingJdbcDataSource.java	31 Mar 2003 18:32:55 -0000	1.5
  @@ -211,10 +211,14 @@
           if( !m_configured ) throw new IllegalStateException( "Not Configured" );
           if( m_disposed ) throw new IllegalStateException( "Already Disposed" );
   
  -        Connection connection;
  +        Object connection;
           try
           {
  -            connection = (Connection)m_pool.get();
  +            connection = m_pool.get();
  +            if (null == connection)
  +            {
  +                throw new SQLException("Could not return Connection");
  +            }
           }
           catch( SQLException e )
           {
  @@ -235,7 +239,7 @@
               throw new NoAvailableConnectionException( e.getMessage() );
           }
   
  -        return connection;
  +        return (Connection)connection;
       }
   
       /*---------------------------------------------------------------
  
  
  

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


Mime
View raw message