resolve regression of some ra transaction tests, follow on from http://svn.apache.org/viewvc?view=revision&revision=1065688 - a shared context needs to be aware that ended transactions that are unresolved are considered active. browse needs to only commit for local transactions when ending

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1069796 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2011-02-11 13:48:33 +00:00
parent 971f61f0d3
commit 8fdf3457e3
2 changed files with 4 additions and 2 deletions

View File

@ -113,7 +113,7 @@ public class ActiveMQQueueBrowser implements QueueBrowser, Enumeration {
return; return;
} }
try { try {
if (session.getTransacted()) { if (session.getTransacted() && session.getTransactionContext().isInLocalTransaction()) {
session.commit(); session.commit();
} }
consumer.close(); consumer.close();

View File

@ -115,7 +115,9 @@ public class ManagedTransactionContext extends TransactionContext {
public boolean isInXATransaction() { public boolean isInXATransaction() {
if (useSharedTxContext) { if (useSharedTxContext) {
return sharedContext.isInXATransaction(); // context considers endesd XA transactions as active, so just check for presence
// of tx when it is shared
return sharedContext.isInTransaction();
} else { } else {
return super.isInXATransaction(); return super.isInXATransaction();
} }