User: mulder  
  Date: 00/08/31 10:28:47

  Modified:    src/main/org/jboss/minerva/jdbc ConnectionInPool.java
  Log:
  Non-transactional pools and JDBC 1/2 wrapper transactional pools will now
  boot a connection out of the pool if there's an error during commit or
  rollback.  Note that with a native JDBC 2 Standard Extension driver, we
  have no way of knowing what method caused an exception so the only way to
  achieve this is to set the invalidateOnError property, which boots the
  connection for *all* exceptions.
  
  Revision  Changes    Path
  1.3       +12 -3     jboss/src/main/org/jboss/minerva/jdbc/ConnectionInPool.java
  
  Index: ConnectionInPool.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/minerva/jdbc/ConnectionInPool.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ConnectionInPool.java     2000/08/30 16:17:05     1.2
  +++ ConnectionInPool.java     2000/08/31 17:28:47     1.3
  @@ -28,7 +28,7 @@
    * outstanding statements are closed, and the connection is rolled back.  This
    * class is also used by statements, etc. to update the last used time for the
    * connection.
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    * @author Aaron Mulder ([EMAIL PROTECTED])
    */
   public class ConnectionInPool implements PooledObject, ConnectionWrapper {
  @@ -98,6 +98,15 @@
       }
   
       /**
  +     * Indicates that an error occured on this connection.
  +     */
  +    public void setCatastrophicError(SQLException e) {
  +        PoolEvent pe = new PoolEvent(this, PoolEvent.OBJECT_ERROR);
  +        pe.setCatastrophic();
  +        firePoolEvent(pe);
  +    }
  +
  +    /**
        * Indicates that a statement has been closed and no longer needs to be
        * tracked.  Outstanding statements are closed when the connection is
        * returned to the pool.
  @@ -216,7 +225,7 @@
           try {
               con.commit();
           } catch(SQLException e) {
  -            setError(e);
  +            setCatastrophicError(e);
               throw e;
           }
       }
  @@ -226,7 +235,7 @@
           try {
               con.rollback();
           } catch(SQLException e) {
  -            setError(e);
  +            setCatastrophicError(e);
               throw e;
           }
       }
  
  
  

Reply via email to