You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2011/01/28 21:04:49 UTC
svn commit: r1064851 -
/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
Author: tabish
Date: Fri Jan 28 20:04:48 2011
New Revision: 1064851
URL: http://svn.apache.org/viewvc?rev=1064851&view=rev
Log:
Fix hang on TX recover.
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs?rev=1064851&r1=1064850&r2=1064851&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs Fri Jan 28 20:04:48 2011
@@ -534,9 +534,7 @@ namespace Apache.NMS.ActiveMQ
return;
}
- //XATransactionId xid = info.Xid;
-
- int matched = 0;
+ List<KeyValuePair<XATransactionId, byte[]>> matches = new List<KeyValuePair<XATransactionId, byte[]>>();
foreach(XATransactionId recoverable in recoverables)
{
@@ -545,20 +543,20 @@ namespace Apache.NMS.ActiveMQ
if(entry.Key.Equals(recoverable))
{
Tracer.DebugFormat("Found a matching TX on Broker to stored Id: {0} reenlisting.", entry.Key);
-
- matched++;
-
- // Reenlist the recovered transaction with the TX Manager.
- // TODO - Hack for now, we really only support one recoverable with this.
- this.transactionId = entry.Key;
- this.currentEnlistment = TransactionManager.Reenlist(ResourceManagerGuid, entry.Value, this);
+ matches.Add(entry);
}
}
}
- if(matched > 0)
+ if (matches.Count != 0)
{
- this.recoveryComplete = new CountDownLatch(matched);
+ this.recoveryComplete = new CountDownLatch(matches.Count);
+
+ foreach (KeyValuePair<XATransactionId, byte[]> recoverable in matches)
+ {
+ TransactionManager.Reenlist(ResourceManagerGuid, recoverable.Value, this);
+ }
+
TransactionManager.RecoveryComplete(ResourceManagerGuid);
this.recoveryComplete.await();
return;