From: Weston P. <wes...@jb...> - 2006-07-07 02:34:28
|
User: wprice Date: 06/07/06 22:34:26 Modified: src/main/org/jboss/resource/adapter/jdbc/xa XAManagedConnection.java Log: [JBAS-3336] XAManagedConnections that experience failure issues (XAER_RMFAIL, XAERR_RMERR) during enlistment are no longer returned to the pool but destroyed. Revision Changes Path 1.19 +27 -4 jbosscx/src/main/org/jboss/resource/adapter/jdbc/xa/XAManagedConnection.java (In the diff below, changes in quantity of whitespace are not shown.) Index: XAManagedConnection.java =================================================================== RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/adapter/jdbc/xa/XAManagedConnection.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -b -r1.18 -r1.19 --- XAManagedConnection.java 31 May 2006 22:39:56 -0000 1.18 +++ XAManagedConnection.java 7 Jul 2006 02:34:26 -0000 1.19 @@ -39,7 +39,8 @@ * * @author <a href="mailto:d_j...@us...">David Jencks </a> * @author <a href="mailto:ad...@jb...">Adrian Brock</a> - * @version $Revision: 1.18 $ + * @author <a href="wes...@jb...">Weston Price</a> + * @version $Revision: 1.19 $ */ public class XAManagedConnection extends BaseWrapperManagedConnection implements XAResource { @@ -114,7 +115,24 @@ { getLog().warn("Error setting state ", e); } + + try + { xaResource.start(xid, flags); + + }catch(XAException e) + { + //JBAS-3336 Connections that fail in enlistment should not be returned + //to the pool + if(isFailedXA(e.errorCode)) + { + getLog().error("Start transaction failed for " + this); + broadcastConnectionError(e); + } + + throw e; + } + synchronized (stateLock) { currentXid = xid; @@ -186,4 +204,9 @@ return xaResource.setTransactionTimeout(seconds); } + private boolean isFailedXA(int errorCode) + { + + return (errorCode == XAException.XAER_RMERR || errorCode == XAException.XAER_RMFAIL); + } } |