resolve regression in JDBCXACommitExceptionTest from https://issues.apache.org/activemq/browse/AMQ-2880

Change http://svn.apache.org/viewvc?rev=1064858&view=rev demostrated need to separate jms transacted
session recovery from xa recovery.
Issue related to using XASession without transactions. https://issues.apache.org/jira/browse/AMQ-2659
fix makes XASession indicated it is transacted during commit processing so that a close does not precipiate
an auto ack. ended transactions, available till forget will keep transacted=true

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1065688 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2011-01-31 17:20:18 +00:00
parent 29c0dff26a
commit aae3ea27f7
2 changed files with 3 additions and 2 deletions

View File

@ -88,7 +88,7 @@ public class TransactionContext implements XAResource {
} }
public boolean isInXATransaction() { public boolean isInXATransaction() {
return transactionId != null && transactionId.isXATransaction(); return (transactionId != null && transactionId.isXATransaction()) || !ENDED_XA_TRANSACTION_CONTEXTS.isEmpty();
} }
public boolean isInLocalTransaction() { public boolean isInLocalTransaction() {
@ -579,6 +579,7 @@ public class TransactionContext implements XAResource {
} catch (JMSException e) { } catch (JMSException e) {
throw toXAException(e); throw toXAException(e);
} }
ENDED_XA_TRANSACTION_CONTEXTS.remove(x);
} }
public boolean isSameRM(XAResource xaResource) throws XAException { public boolean isSameRM(XAResource xaResource) throws XAException {

View File

@ -108,7 +108,7 @@ public class JDBCXACommitExceptionTest extends JDBCCommitExceptionTest {
LOG.debug("Caught exception:", e); LOG.debug("Caught exception:", e);
try { try {
LOG.debug("Rolling back transaction (just in case, no need to do this as it is implicit in a commit failure) " + tid); LOG.debug("Rolling back transaction (just in case, no need to do this as it is implicit in a 1pc commit failure) " + tid);
resource.rollback(tid); resource.rollback(tid);
} }
catch (XAException ex) { catch (XAException ex) {