avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/datasource AbstractJdbcConnection.java Jdbc3Connection.java JdbcConnection.java
Date Wed, 23 Jan 2002 15:49:52 GMT
bloritsch    02/01/23 07:49:52

  Modified:    src/java/org/apache/avalon/excalibur/datasource
                        AbstractJdbcConnection.java Jdbc3Connection.java
                        JdbcConnection.java
  Log:
  fix JDBC last use to be based on last call to connection rather than length of time in the
pool
  
  Revision  Changes    Path
  1.10      +2 -2      jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/datasource/AbstractJdbcConnection.java
  
  Index: AbstractJdbcConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/datasource/AbstractJdbcConnection.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- AbstractJdbcConnection.java	23 Jan 2002 14:57:00 -0000	1.9
  +++ AbstractJdbcConnection.java	23 Jan 2002 15:49:52 -0000	1.10
  @@ -29,7 +29,7 @@
    * total number of Connection objects that are created.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.9 $ $Date: 2002/01/23 14:57:00 $
  + * @version CVS $Revision: 1.10 $ $Date: 2002/01/23 15:49:52 $
    * @since 4.1
    */
   public abstract class AbstractJdbcConnection
  @@ -104,7 +104,7 @@
       }
   
       public void recycle() {
  -        m_lastUsed = System.currentTimeMillis();
  +        //m_lastUsed = System.currentTimeMillis(); // not accurate
           m_testException = null;
           try
           {
  
  
  
  1.10      +67 -24    jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/datasource/Jdbc3Connection.java
  
  Index: Jdbc3Connection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/datasource/Jdbc3Connection.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Jdbc3Connection.java	11 Dec 2001 09:53:28 -0000	1.9
  +++ Jdbc3Connection.java	23 Jan 2002 15:49:52 -0000	1.10
  @@ -26,7 +26,7 @@
    * total number of Connection objects that are created.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.9 $ $Date: 2001/12/11 09:53:28 $
  + * @version CVS $Revision: 1.10 $ $Date: 2002/01/23 15:49:52 $
    * @since 4.0
    */
   public class Jdbc3Connection
  @@ -40,19 +40,25 @@
       public final Statement createStatement()
           throws SQLException
       {
  -        return m_connection.createStatement();
  +        final Statement temp = m_connection.createStatement();
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final PreparedStatement prepareStatement( final String sql )
           throws SQLException
       {
  -        return m_connection.prepareStatement( sql );
  +        final PreparedStatement temp = m_connection.prepareStatement( sql );
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final CallableStatement prepareCall( final String sql )
           throws SQLException
       {
  -        return m_connection.prepareCall( sql );
  +        final CallableStatement temp = m_connection.prepareCall( sql );
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final String nativeSQL( final String sql )
  @@ -77,12 +83,14 @@
           throws SQLException
       {
           m_connection.commit();
  +        m_lastUsed = System.currentTimeMillis();
       }
   
       public final void rollback()
           throws SQLException
       {
           m_connection.rollback();
  +        m_lastUsed = System.currentTimeMillis();
       }
   
       public final DatabaseMetaData getMetaData()
  @@ -143,7 +151,12 @@
                                               final int resultSetConcurrency )
           throws SQLException
       {
  -        return m_connection.createStatement(resultSetType, resultSetConcurrency);
  +        final Statement temp = m_connection.createStatement(
  +                resultSetType, resultSetConcurrency
  +        );
  +
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final PreparedStatement prepareStatement( final String sql,
  @@ -151,7 +164,12 @@
                                                  final int resultSetConcurrency )
           throws SQLException
       {
  -        return m_connection.prepareStatement( sql, resultSetType, resultSetConcurrency
);
  +        final PreparedStatement temp = m_connection.prepareStatement(
  +                sql, resultSetType, resultSetConcurrency
  +        );
  +
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final CallableStatement prepareCall( final String sql,
  @@ -159,7 +177,12 @@
                                             final int resultSetConcurrency )
           throws SQLException
       {
  -        return m_connection.prepareCall( sql, resultSetType, resultSetConcurrency );
  +        final CallableStatement temp = m_connection.prepareCall(
  +            sql, resultSetType, resultSetConcurrency
  +        );
  +
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final Map getTypeMap()
  @@ -202,6 +225,7 @@
           throws SQLException
       {
           m_connection.rollback(savepoint);
  +        m_lastUsed = System.currentTimeMillis();
       }
   
       public final void releaseSavepoint(Savepoint savepoint)
  @@ -215,9 +239,12 @@
                                              int resultSetHoldability)
           throws SQLException
       {
  -        return m_connection.createStatement(resulSetType,
  -                                            resultSetConcurrency,
  -                                            resultSetHoldability);
  +        final Statement temp = m_connection.createStatement(
  +                resultSetType, resultSetConcurrency, resultSetHoldability
  +        );
  +
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final PreparedStatement prepareStatement(String sql,
  @@ -226,10 +253,12 @@
                                           int resultSetHoldability)
           throws SQLException
       {
  -        return m_connection.prepareStatement(sql,
  -                                             resulSetType,
  -                                             resultSetConcurrency,
  -                                             resultSetHoldability);
  +        final PreparedStatement temp = m_connection.prepareStatement(
  +            sql, resultSetType, resultSetConcurrency, resultSetHoldability
  +        );
  +
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final CallableStatement prepareCall(String sql,
  @@ -238,33 +267,47 @@
                                           int resultSetHoldability)
           throws SQLException
       {
  -        return m_connection.prepareCall(sql,
  -                                        resulSetType,
  -                                        resultSetConcurrency,
  -                                        resultSetHoldability);
  +        final CallableStatement temp = m_connection.prepareCall(
  +            sql, resultSetType, resultSetConcurrency, resultSetHoldability
  +        );
  +
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final PreparedStatement prepareStatement(String sql,
                                           int autoGeneratedKeys)
           throws SQLException
       {
  -        return m_connection.prepareStatement(sql,
  -                                             autoGeneratedKeys);
  +        final PreparedStatement temp = m_connection.prepareStatement(
  +                sql, autoGeneratedKeys
  +        );
  +
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final PreparedStatement prepareStatement(String sql,
                                           int[] columnIndexes)
           throws SQLException
       {
  -        return m_connection.prepareStatement(sql,
  -                                             columnIndexes);
  +        final PreparedStatement temp = m_connection.prepareStatement(
  +                sql, columnIndexes
  +        );
  +
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final PreparedStatement prepareStatement(String sql,
                                           String[] columnNames)
           throws SQLException
       {
  -       return m_connection.prepareStatement(sql,
  -                                            columnNames);
  +        final PreparedStatement temp = m_connection.prepareStatement(
  +                sql, columnNames
  +        );
  +
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   }
  
  
  
  1.4       +30 -7     jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/datasource/JdbcConnection.java
  
  Index: JdbcConnection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/datasource/JdbcConnection.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JdbcConnection.java	11 Dec 2001 09:53:28 -0000	1.3
  +++ JdbcConnection.java	23 Jan 2002 15:49:52 -0000	1.4
  @@ -25,7 +25,7 @@
    * total number of Connection objects that are created.
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.3 $ $Date: 2001/12/11 09:53:28 $
  + * @version CVS $Revision: 1.4 $ $Date: 2002/01/23 15:49:52 $
    * @since 4.0
    */
   public class JdbcConnection
  @@ -40,19 +40,25 @@
       public final Statement createStatement()
           throws SQLException
       {
  -        return m_connection.createStatement();
  +        final Statement temp = m_connection.createStatement();
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final PreparedStatement prepareStatement( final String sql )
           throws SQLException
       {
  -        return m_connection.prepareStatement( sql );
  +        final PreparedStatement temp = m_connection.prepareStatement( sql );
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final CallableStatement prepareCall( final String sql )
           throws SQLException
       {
  -        return m_connection.prepareCall( sql );
  +        final CallableStatement temp = m_connection.prepareCall( sql );
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final String nativeSQL( final String sql )
  @@ -77,12 +83,14 @@
           throws SQLException
       {
           m_connection.commit();
  +        m_lastUsed = System.currentTimeMillis();
       }
   
       public final void rollback()
           throws SQLException
       {
           m_connection.rollback();
  +        m_lastUsed = System.currentTimeMillis();
       }
   
       public final DatabaseMetaData getMetaData()
  @@ -143,7 +151,12 @@
                                               final int resultSetConcurrency )
           throws SQLException
       {
  -        return m_connection.createStatement(resultSetType, resultSetConcurrency);
  +        final Statement temp = m_connection.createStatement(
  +                resultSetType, resultSetConcurrency
  +        );
  +
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final PreparedStatement prepareStatement( final String sql,
  @@ -151,7 +164,12 @@
                                                  final int resultSetConcurrency )
           throws SQLException
       {
  -        return m_connection.prepareStatement( sql, resultSetType, resultSetConcurrency
);
  +        final PreparedStatement temp = m_connection.prepareStatement(
  +                sql, resultSetType, resultSetConcurrency
  +        );
  +
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final CallableStatement prepareCall( final String sql,
  @@ -159,7 +177,12 @@
                                             final int resultSetConcurrency )
           throws SQLException
       {
  -        return m_connection.prepareCall( sql, resultSetType, resultSetConcurrency );
  +        final CallableStatement temp = m_connection.prepareCall(
  +            sql, resultSetType, resultSetConcurrency
  +        );
  +
  +        m_lastUsed = System.currentTimeMillis();
  +        return temp;
       }
   
       public final Map getTypeMap()
  
  
  

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


Mime
View raw message