Author: djencks Date: Sat Mar 19 19:37:19 2005 New Revision: 158290 URL: http://svn.apache.org/viewcvs?view=rev&rev=158290 Log: If a connection can't be enlisted, we must dispose of it before throwing an exception
Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java Modified: geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java?view=diff&r1=158289&r2=158290 ============================================================================== --- geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java (original) +++ geronimo/trunk/modules/connector/src/java/org/apache/geronimo/connector/outbound/TransactionEnlistingInterceptor.java Sat Mar 19 19:37:19 2005 @@ -53,11 +53,16 @@ transactionContext.enlistResource(xares); } } catch (SystemException e) { + returnConnection(connectionInfo, ConnectionReturnAction.DESTROY); throw new ResourceException("Could not get transaction", e); } catch (RollbackException e) { + //transaction is marked rolled back, so the xaresource could not have been enlisted + next.returnConnection(connectionInfo, ConnectionReturnAction.RETURN_HANDLE); throw new ResourceException("Could not enlist resource in rolled back transaction", e); + } catch (Throwable t) { + returnConnection(connectionInfo, ConnectionReturnAction.DESTROY); + throw new ResourceException("Unknown throwable when trying to enlist connection in tx", t); } - } /** @@ -81,6 +86,8 @@ } catch (SystemException e) { //maybe we should warn??? + connectionReturnAction = ConnectionReturnAction.DESTROY; + } catch (IllegalStateException e) { connectionReturnAction = ConnectionReturnAction.DESTROY; }