activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgo...@apache.org
Subject svn commit: r807799 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp: Connection.cs MessageConsumer.cs Session.cs TransactionContext.cs
Date Tue, 25 Aug 2009 20:53:41 GMT
Author: jgomes
Date: Tue Aug 25 20:53:40 2009
New Revision: 807799

URL: http://svn.apache.org/viewvc?rev=807799&view=rev
Log:
Set ResponseRequired to false for asynchronous commands.
Fixes [AMQNET-182]. (See https://issues.apache.org/activemq/browse/AMQNET-182)

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

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs?rev=807799&r1=807798&r2=807799&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs Tue Aug
25 20:53:40 2009
@@ -204,6 +204,7 @@
 
 				try
 				{
+					Tracer.Info("Closing Connection.");
 					this.closing = true;
 					lock(sessions.SyncRoot)
 					{
@@ -217,7 +218,9 @@
 					if(connected)
 					{
 						DisposeOf(ConnectionId);
-						transport.Oneway(new ShutdownInfo());
+						ShutdownInfo shutdowninfo = new ShutdownInfo();
+						shutdowninfo.ResponseRequired = false;
+						transport.Oneway(shutdowninfo);
 					}
 
 					transport.Dispose();
@@ -347,7 +350,7 @@
 			return response;
 		}
 
-		public void OneWay(Command command)
+		public void Oneway(Command command)
 		{
 			CheckConnected();
 			transport.Oneway(command);
@@ -359,8 +362,12 @@
 			command.ObjectId = objectId;
 			if(asyncClose)
 			{
-				Tracer.Info("Asynchronously closing Connection.");
-				OneWay(command);
+				Tracer.Info("Asynchronously disposing of Connection.");
+				if(connected)
+				{
+					command.ResponseRequired = false;
+					transport.Oneway(command);
+				}
 			}
 			else
 			{
@@ -369,7 +376,7 @@
 				// the broker can dispose of the object.  Allow up to 5 seconds to process.
 				try
 				{
-					Tracer.Info("Synchronously closing Connection...");
+					Tracer.Info("Synchronously disposing of Connection.");
 					SyncRequest(command, TimeSpan.FromSeconds(5));
 				}
 				catch // (BrokerException)
@@ -467,7 +474,7 @@
 					}
 
 					OnException(commandTransport, new NMSConnectionException(message, cause));
-			    }
+				}
 			}
 			else
 			{
@@ -479,11 +486,11 @@
 		{
 			bool dispatched = false;
 
-            // Override the Message's Destination with the one from the Dispatch since in
the
-            // case of a virtual Topic the correct destination ack is the one from the Dispatch.
-            // This is a bit of a hack since we should really be sending the entire dispatch
to
-            // the Consumer.
-            dispatch.Message.Destination = dispatch.Destination;
+			// Override the Message's Destination with the one from the Dispatch since in the
+			// case of a virtual Topic the correct destination ack is the one from the Dispatch.
+			// This is a bit of a hack since we should really be sending the entire dispatch to
+			// the Consumer.
+			dispatch.Message.Destination = dispatch.Destination;
 
 			lock(sessions.SyncRoot)
 			{
@@ -510,8 +517,11 @@
 			{
 				try
 				{
-					info.ResponseRequired = false;
-					OneWay(info);
+					if(connected)
+					{
+						info.ResponseRequired = false;
+						transport.Oneway(info);
+					}
 				}
 				catch(Exception ex)
 				{

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs?rev=807799&r1=807798&r2=807799&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/MessageConsumer.cs
Tue Aug 25 20:53:40 2009
@@ -205,7 +205,7 @@
 						throw new ConnectionClosedException();
 					}
 
-					ackSession.Connection.OneWay(ack);
+					ackSession.Connection.Oneway(ack);
 				}
 			}
 
@@ -273,7 +273,7 @@
 						throw new ConnectionClosedException();
 					}
 
-					session.Connection.OneWay(messagePull);
+					session.Connection.Oneway(messagePull);
 				}
 			}
 		}
@@ -293,7 +293,7 @@
 					throw new ConnectionClosedException();
 				}
 
-				session.Connection.OneWay(ack);
+				session.Connection.Oneway(ack);
 			}
 		}
 
@@ -331,7 +331,7 @@
 				ack.FirstMessageId = message.MessageId;
 				ack.LastMessageId = message.MessageId;
 				ack.MessageCount = 1;
-				session.Connection.OneWay(ack);
+				session.Connection.Oneway(ack);
 			}
 			else
 			{

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=807799&r1=807798&r2=807799&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 Aug
25 20:53:40 2009
@@ -479,7 +479,7 @@
         {
             if(AsyncSend)
             {
-                Connection.OneWay(message);
+                Connection.Oneway(message);
             }
             else
             {

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=807799&r1=807798&r2=807799&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 Aug 25 20:53:40 2009
@@ -64,7 +64,7 @@
                 info.ConnectionId = session.Connection.ConnectionId;
                 info.TransactionId = transactionId;
                 info.Type = (int) TransactionType.Begin;
-                session.Connection.OneWay(info);
+                session.Connection.Oneway(info);
             }
         }
         
@@ -79,7 +79,7 @@
                 info.Type = (int) TransactionType.Rollback;
                 
                 transactionId = null;
-                session.Connection.OneWay(info);
+                session.Connection.Oneway(info);
             }
             
             foreach (ISynchronization synchronization in synchronizations)
@@ -104,7 +104,7 @@
                 info.Type = (int) TransactionType.CommitOnePhase;
                 
                 transactionId = null;
-                session.Connection.OneWay(info);
+                session.Connection.Oneway(info);
             }
             
             foreach (ISynchronization synchronization in synchronizations)



Mime
View raw message