activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1057906 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/TransactionContext.cs
Date Tue, 11 Jan 2011 22:51:47 GMT
Author: tabish
Date: Tue Jan 11 22:51:47 2011
New Revision: 1057906

URL: http://svn.apache.org/viewvc?rev=1057906&view=rev
Log:
https://issues.apache.org/jira/browse/AMQNET-290

Add some additional error checks and cleanup some exception handlers some more.

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=1057906&r1=1057905&r2=1057906&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
Tue Jan 11 22:51:47 2011
@@ -239,26 +239,26 @@ namespace Apache.NMS.ActiveMQ
 
             if(Tracer.IsDebugEnabled)
             {
-                Tracer.Debug("Begin XA'ish Transaction:" + xaId.GlobalTransactionId.ToString());
+                Tracer.Debug("Began XA'ish Transaction:" + xaId.GlobalTransactionId.ToString());
             }
         }
 
         public void Prepare(PreparingEnlistment preparingEnlistment)
         {
-            Tracer.Debug("Prepare notification received");
-
-            // Now notify the broker that a new XA'ish transaction has started.
-            TransactionInfo info = new TransactionInfo();
-            info.ConnectionId = this.session.Connection.ConnectionId;
-            info.TransactionId = this.transactionId;
-
             try
             {
+	            Tracer.Debug("Prepare notification received");
+				
                 BeforeEnd();
 
-                // End the current branch
+	            // Now notify the broker that a new XA'ish transaction has started.
+	            TransactionInfo info = new TransactionInfo();
+	            info.ConnectionId = this.session.Connection.ConnectionId;
+	            info.TransactionId = this.transactionId;
                 info.Type = (int) TransactionType.End;
-                this.connection.SyncRequest(info);
+
+                this.connection.CheckConnected();
+				this.connection.SyncRequest(info);
 
                 // Prepare the Transaction for commit.
                 info.Type = (int) TransactionType.Prepare;
@@ -322,12 +322,7 @@ namespace Apache.NMS.ActiveMQ
             {
                 Tracer.Debug("Transaction Commit failed with error: " + ex.Message);
                 AfterRollback();
-                Transaction tx = Transaction.Current;
-                if(tx != null)
-                {
-                    tx.Rollback(ex);
-                }
-
+                enlistment.Done();
                 throw;
             }
             finally
@@ -380,10 +375,10 @@ namespace Apache.NMS.ActiveMQ
 		
         public void Rollback(Enlistment enlistment)
         {
-            Tracer.Debug("Rollback notification received");
-
             try
             {
+	            Tracer.Debug("Rollback notification received");
+
                 BeforeEnd();
 
                 // Now notify the broker that a new XA'ish transaction has started.
@@ -422,10 +417,10 @@ namespace Apache.NMS.ActiveMQ
 
         public void InDoubt(Enlistment enlistment)
         {
-            Tracer.Debug("In doubt notification received, Rolling Back TX");
-
             try
             {
+	            Tracer.Debug("In doubt notification received, Rolling Back TX");
+				
                 BeforeEnd();
 
                 // Now notify the broker that Rollback should be performed.



Mime
View raw message