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/04/27 00:53:16 UTC

svn commit: r1096941 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs

Author: tabish
Date: Tue Apr 26 22:53:16 2011
New Revision: 1096941

URL: http://svn.apache.org/viewvc?rev=1096941&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQNET-326

Don't do anything with TX locking if not in a TX when close is entered.

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs?rev=1096941&r1=1096940&r2=1096941&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Session.cs Tue Apr 26 22:53:16 2011
@@ -299,22 +299,23 @@ namespace Apache.NMS.ActiveMQ
             }
 
             try
-            {
-                TransactionContext.SyncRoot.WaitOne();
-                
+            {                
                 if (transactionContext.InNetTransaction)
                 {
-                    TransactionContext.SyncRoot.ReleaseMutex();
+                    TransactionContext.SyncRoot.WaitOne();
 
-                    // Must wait for all the DTC operations to complete before
-                    // moving on from this close call.
-                    this.transactionContext.DtcWaitHandle.WaitOne();
+                    if (transactionContext.InNetTransaction)
+                    {
+                        // Must wait for all the DTC operations to complete before
+                        // moving on from this close call.
+                        TransactionContext.SyncRoot.ReleaseMutex();
+                        this.transactionContext.DtcWaitHandle.WaitOne();
+                        TransactionContext.SyncRoot.WaitOne();
+                    }
 
-                    TransactionContext.SyncRoot.WaitOne();
+                    TransactionContext.SyncRoot.ReleaseMutex();
                 }
 
-                TransactionContext.SyncRoot.ReleaseMutex();
-
                 Tracer.InfoFormat("Closing The Session with Id {0}", this.info.SessionId);
                 DoClose();
                 Tracer.InfoFormat("Closed The Session with Id {0}", this.info.SessionId);