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

  Modified:    src/main/org/jboss/minerva/xa TransactionListener.java
                        XAConnectionImpl.java XAResourceImpl.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       +7 -1      jboss/src/main/org/jboss/minerva/xa/TransactionListener.java
  
  Index: TransactionListener.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/minerva/xa/TransactionListener.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TransactionListener.java  2000/08/30 12:41:53     1.2
  +++ TransactionListener.java  2000/08/31 17:28:48     1.3
  @@ -10,7 +10,7 @@
   
   /**
    * Callback for notification when a transaction is finished.
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    * @author Aaron Mulder ([EMAIL PROTECTED])
    */
   public interface TransactionListener {
  @@ -18,4 +18,10 @@
        * Indicates that the transaction this instance was part of has finished.
        */
       public void transactionFinished(XAConnectionImpl con);
  +
  +    /**
  +     * Indicates that the transaction this instance was part of has finished,
  +     * and there was a fatal error.  Any pooled resources should be recycled.
  +     */
  +    public void transactionFailed(XAConnectionImpl con);
   }
  
  
  
  1.4       +14 -5     jboss/src/main/org/jboss/minerva/xa/XAConnectionImpl.java
  
  Index: XAConnectionImpl.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/minerva/xa/XAConnectionImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XAConnectionImpl.java     2000/08/30 16:17:07     1.3
  +++ XAConnectionImpl.java     2000/08/31 17:28:48     1.4
  @@ -40,7 +40,7 @@
    * also register a TransactionListener that will be notified when the
    * Transaction is finished, and release the XAConnection at that time.</P>
    * @see org.jboss.minerva.xa.TransactionListener
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    * @author Aaron Mulder ([EMAIL PROTECTED])
    */
   public class XAConnectionImpl implements XAConnection {
  @@ -123,6 +123,17 @@
       }
   
       /**
  +     * Indicates that the outstanding transaction has finished with a fatal
  +     * error, and this object should be closed or permanently removed from a
  +     * pool.  This dispatches a close event to all listeners.
  +     * @see #addConnectionEventListener
  +     */
  +    public void transactionFailed() {
  +        if(transListener != null)
  +            transListener.transactionFailed(this);
  +    }
  +
  +    /**
        * Indicates that the connection given to the client has had an error.
        * If there is currently a transaction, this object should not be closed or
        * returned to a pool.  If not, it can be closed or returned immediately.
  @@ -139,10 +150,8 @@
        * no transaction will be committed or rolled back but this connection
        * will be reused, we must roll it back.
        */
  -    public void rollback() {
  -        try {
  -            con.rollback();
  -        } catch(SQLException e) {}
  +    public void rollback() throws SQLException {
  +        con.rollback();
       }
   
       // ---- Implementation of javax.sql.XAConnection ----
  
  
  
  1.4       +2 -2      jboss/src/main/org/jboss/minerva/xa/XAResourceImpl.java
  
  Index: XAResourceImpl.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/minerva/xa/XAResourceImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XAResourceImpl.java       2000/08/30 12:41:53     1.3
  +++ XAResourceImpl.java       2000/08/31 17:28:49     1.4
  @@ -22,7 +22,7 @@
    * <P><FONT COLOR="RED"><B>Warning:</B></FONT></P> This implementation assumes
    * that forget will be called after a failed commit or rollback.  Otherwise,
    * the database connection will never be closed.</P>
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    * @author Aaron Mulder ([EMAIL PROTECTED])
    */
   public class XAResourceImpl implements XAResource {
  @@ -137,7 +137,7 @@
           if(current == null || !id.equals(current))
               throw new XAException(XAException.XAER_NOTA);
           current = null;
  -        xaCon.transactionFinished();
  +        xaCon.transactionFailed();
       }
   
       /**
  
  
  

Reply via email to