activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1064851 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
Date Fri, 28 Jan 2011 20:04:49 GMT
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;



Mime
View raw message