git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1484999 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2013-05-21 22:18:36 +00:00
parent 18eb6b239d
commit d9b54d6ae8
1 changed files with 10 additions and 1 deletions

View File

@ -594,13 +594,16 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
}
});
// rollback any recovered inflight local transactions
// rollback any recovered inflight local transactions, and discard any inflight XA transactions.
Set<TransactionId> toRollback = new HashSet<TransactionId>();
Set<TransactionId> toDiscard = new HashSet<TransactionId>();
synchronized (inflightTransactions) {
for (Iterator<TransactionId> it = inflightTransactions.keySet().iterator(); it.hasNext(); ) {
TransactionId id = it.next();
if (id.isLocalTransaction()) {
toRollback.add(id);
} else {
toDiscard.add(id);
}
}
for (TransactionId tx: toRollback) {
@ -609,6 +612,12 @@ public abstract class MessageDatabase extends ServiceSupport implements BrokerSe
}
store(new KahaRollbackCommand().setTransactionInfo(TransactionIdConversion.convertToLocal(tx)), false, null, null);
}
for (TransactionId tx: toDiscard) {
if (LOG.isDebugEnabled()) {
LOG.debug("discarding recovered in-flight XA transaction " + tx);
}
inflightTransactions.remove(tx);
}
}
synchronized (preparedTransactions) {