activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgo...@apache.org
Subject svn commit: r1689529 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x: ./ nant.build src/main/csharp/NetTxConnection.cs src/main/csharp/NetTxMessageConsumer.cs src/main/csharp/NetTxSession.cs src/test/csharp/DtcTransactionsTestSupport.cs
Date Tue, 07 Jul 2015 00:02:02 GMT
Author: jgomes
Date: Tue Jul  7 00:02:01 2015
New Revision: 1689529

URL: http://svn.apache.org/r1689529
Log:
Merged revision(s) 1689517 from activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk:
Apply patch from Jose Alvarado. Thanks, Jose!
Fixes [AMQNET-503]. (See https://issues.apache.org/jira/browse/AMQNET-503)

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/   (props changed)
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/nant.build
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxConnection.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxMessageConsumer.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxSession.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/test/csharp/DtcTransactionsTestSupport.cs

Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul  7 00:02:01 2015
@@ -1,3 +1,4 @@
 /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x:1082291,1135831,1137081,1171843,1171874,1177390,1177395,1186568,1187123,1238881,1293360,1294890,1295257,1311395,1312026,1374469,1375295,1376782
 /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.0.0:692591,693525
 /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/tags/1.1.0:788230,788233,790183
+/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk:1689517

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/nant.build
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/nant.build?rev=1689529&r1=1689528&r2=1689529&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/nant.build (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/nant.build Tue Jul  7 00:02:01
2015
@@ -51,7 +51,7 @@
         <!-- Property grouping for 'vendor.apache.org' -->
         <property name="vendor.apache.org.name" value="Apache.NMS" />
         <property name="vendor.apache.org.group" value="org.apache.activemq" />
-        <property name="vendor.apache.org.version" value="1.7.0" />
+        <property name="vendor.apache.org.version" value="1.7.1" />
         <if test="${current.build.framework == 'mono-2.0' or current.build.framework ==
'mono-4.0'}">
             <property name="vendor.apache.org.filenames" value="Apache.NMS.dll,Apache.NMS.dll.mdb,Apache.NMS.Test.dll,Apache.NMS.Test.dll.mdb"
/>
         </if>

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxConnection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxConnection.cs?rev=1689529&r1=1689528&r2=1689529&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxConnection.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxConnection.cs
Tue Jul  7 00:02:01 2015
@@ -51,6 +51,21 @@ namespace Apache.NMS.ActiveMQ
             return session;
         }
 
+        public INetTxSession CreateNetTxSession(Transaction tx, bool enlistNativeMsDtcResource)
+        {
+            NetTxSession session = (NetTxSession)CreateSession(AcknowledgementMode.Transactional);
+            session.Enlist(tx);
+            session.EnlistsMsDtcNativeResource = enlistNativeMsDtcResource;
+            return session;
+        }
+
+        public INetTxSession CreateNetTxSession(bool enlistNativeMsDtcResource)
+        {
+            NetTxSession session = (NetTxSession)CreateSession(AcknowledgementMode.Transactional);
+            session.EnlistsMsDtcNativeResource = enlistNativeMsDtcResource;
+            return session;
+        }
+
         protected override Session CreateActiveMQSession(AcknowledgementMode ackMode)
         {
             CheckConnected();

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxMessageConsumer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxMessageConsumer.cs?rev=1689529&r1=1689528&r2=1689529&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxMessageConsumer.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxMessageConsumer.cs
Tue Jul  7 00:02:01 2015
@@ -18,6 +18,7 @@
 using System;
 using System.Collections.Generic;
 using System.Text;
+using System.Transactions;
 using Apache.NMS.ActiveMQ.Commands;
 
 namespace Apache.NMS.ActiveMQ
@@ -75,9 +76,29 @@ namespace Apache.NMS.ActiveMQ
                         // distributed TX manager we need to wait whenever the TX is being
                         // controlled by the DTC as it completes all operations async and
                         // we cannot start consumption again until all its tasks have completed.)
-                        waitForDtcWaitHandle = this.transactionContext.InNetTransaction &&
-                                               this.transactionContext.NetTxState ==
-                                               NetTxTransactionContext.TxState.Pending;
+                        var currentTransactionId = transactionContext.TransactionId as XATransactionId;
+                        string currentLocalTxId = currentTransactionId != null
+                            ? UTF8Encoding.UTF8.GetString(currentTransactionId.GlobalTransactionId)
+                            : "NONE";
+
+                        if (Transaction.Current != null)
+                        {
+                            waitForDtcWaitHandle = this.transactionContext.InNetTransaction
&&
+                                               this.transactionContext.NetTxState == NetTxTransactionContext.TxState.Pending
||
+                                               currentLocalTxId != Transaction.Current.TransactionInformation.LocalIdentifier;
+                        }
+                        else
+                        {
+                            waitForDtcWaitHandle = this.transactionContext.InNetTransaction
&&
+                                               this.transactionContext.NetTxState == NetTxTransactionContext.TxState.Pending;
+                        }
+                        
+                    }
+
+                    //if session EnlistMsDtcNativeResource the transaction does not need
to wait
+                    if (this.session.EnlistsMsDtcNativeResource)
+                    {
+                        waitForDtcWaitHandle = false;
                     }
 
                     if (waitForDtcWaitHandle)

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxSession.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxSession.cs?rev=1689529&r1=1689528&r2=1689529&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxSession.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/main/csharp/NetTxSession.cs
Tue Jul  7 00:02:01 2015
@@ -32,6 +32,7 @@ namespace Apache.NMS.ActiveMQ
         {
             this.transactionContext = TransactionContext as NetTxTransactionContext;
             this.transactionContext.InitializeDtcTxContext();
+            this.enlistMsDtcNativeResources = false;
         }
 
         /// <summary>
@@ -51,6 +52,14 @@ namespace Apache.NMS.ActiveMQ
             this.EnrollInSpecifiedTransaction(tx);
         }
 
+        private bool enlistMsDtcNativeResources;
+
+        public bool EnlistsMsDtcNativeResource
+        {
+            get { return enlistMsDtcNativeResources; }
+            set { enlistMsDtcNativeResources = value; }
+        }
+
         /// <summary>
         /// Reports Transacted whenever there is an Ambient Transaction or the internal
         /// TransactionContext is still involed in a .NET Transaction beyond the lifetime
@@ -173,6 +182,7 @@ namespace Apache.NMS.ActiveMQ
             this.currentTransactionId = tx.TransactionInformation.LocalIdentifier; 
             transactionContext.Begin(tx);
         }
+        
     }
 }
 

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/test/csharp/DtcTransactionsTestSupport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/test/csharp/DtcTransactionsTestSupport.cs?rev=1689529&r1=1689528&r2=1689529&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/test/csharp/DtcTransactionsTestSupport.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.7.x/src/test/csharp/DtcTransactionsTestSupport.cs
Tue Jul  7 00:02:01 2015
@@ -53,7 +53,8 @@ namespace Apache.NMS.ActiveMQ.Test
         private ITrace oldTracer;
 
         protected const string sqlConnectionString =
-            "Data Source=localhost;Initial Catalog=TestDB;User ID=user;Password=password";
+            // "Data Source=localhost;Initial Catalog=TestDB;User ID=user;Password=password";
+            "Data Source=.\\SQLEXPRESS;Initial Catalog=TestDB;Integrated Security = true";
         protected const string testTable = "TestTable";
         protected const string testColumn = "TestID";
         protected const string testQueueName = "TestQueue";
@@ -484,7 +485,7 @@ namespace Apache.NMS.ActiveMQ.Test
         {
             IList entries = ExtractDataSet();
 
-            using (INetTxSession session = connection.CreateNetTxSession())
+            using (INetTxSession session = connection.CreateNetTxSession(true))
             {
                 IQueue queue = session.GetQueue(testQueueName);
 
@@ -531,7 +532,7 @@ namespace Apache.NMS.ActiveMQ.Test
         {
             IList entries = ExtractDataSet();
 
-            using (INetTxSession session = connection.CreateNetTxSession())
+            using (INetTxSession session = connection.CreateNetTxSession(true))
             {
                 IQueue queue = session.GetQueue(testQueueName);
 
@@ -578,7 +579,7 @@ namespace Apache.NMS.ActiveMQ.Test
 
         protected static void ReadFromQueueAndInsertIntoDbWithCommit(INetTxConnection connection)
         {
-            using (INetTxSession session = connection.CreateNetTxSession())
+            using (INetTxSession session = connection.CreateNetTxSession(true))
             {
                 IQueue queue = session.GetQueue(testQueueName);
 
@@ -619,7 +620,7 @@ namespace Apache.NMS.ActiveMQ.Test
 
         protected static void ReadFromQueueAndInsertIntoDbWithScopeAborted(INetTxConnection
connection)
         {
-            using (INetTxSession session = connection.CreateNetTxSession())
+            using (INetTxSession session = connection.CreateNetTxSession(true))
             {
                 IQueue queue = session.GetQueue(testQueueName);
 



Mime
View raw message