activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgo...@apache.org
Subject svn commit: r687504 - in /activemq/activemq-dotnet: Apache.NMS.ActiveMQ/trunk/src/main/csharp/ Apache.NMS.ActiveMQ/trunk/src/test/csharp/ Apache.NMS/trunk/src/main/csharp/ Apache.NMS/trunk/src/main/csharp/Util/ Apache.NMS/trunk/src/test/csharp/
Date Wed, 20 Aug 2008 23:25:00 GMT
Author: jgomes
Date: Wed Aug 20 16:25:00 2008
New Revision: 687504

URL: http://svn.apache.org/viewvc?rev=687504&view=rev
Log:
Modified Session to register/unregister exception handler when starting/stopping the dispatchingThread.
Updated SessionUtils to check for proper length of strings when doing comparisons.

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

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CommonAssemblyInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CommonAssemblyInfo.cs?rev=687504&r1=687503&r2=687504&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CommonAssemblyInfo.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/CommonAssemblyInfo.cs
Wed Aug 20 16:25:00 2008
@@ -5,7 +5,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:2.0.50727.1433
+//     Runtime Version:2.0.50727.3053
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.

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=687504&r1=687503&r2=687504&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 Wed Aug
20 16:25:00 2008
@@ -30,6 +30,7 @@
 		private readonly IDictionary consumers = Hashtable.Synchronized(new Hashtable());
 		private readonly IDictionary producers = Hashtable.Synchronized(new Hashtable());
 		private readonly DispatchingThread dispatchingThread;
+		private DispatchingThread.ExceptionHandler dispatchingThread_ExceptionHandler;
 		private readonly SessionInfo info;
 		private long producerCounter;
 		internal bool startedAsyncDelivery = false;
@@ -46,7 +47,7 @@
 			this.PrefetchSize = 1000;
 			this.TransactionContext = new TransactionContext(this);
 			this.dispatchingThread = new DispatchingThread(new DispatchingThread.DispatchFunction(DispatchAsyncMessages));
-			this.dispatchingThread.ExceptionListener += new DispatchingThread.ExceptionHandler(dispatchingThread_ExceptionListener);
+			this.dispatchingThread_ExceptionHandler = new DispatchingThread.ExceptionHandler(dispatchingThread_ExceptionListener);
 		}
 
 		~Session()
@@ -411,7 +412,16 @@
 
 		private void dispatchingThread_ExceptionListener(Exception exception)
 		{
-			Connection.OnSessionException(this, exception);
+			if(null != Connection)
+			{
+				try
+				{
+					Connection.OnSessionException(this, exception);
+				}
+				catch
+				{
+				}
+			}
 		}
 
 		protected void CreateTemporaryDestination(ActiveMQDestination tempDestination)
@@ -591,6 +601,7 @@
 		{
 			if(startedAsyncDelivery)
 			{
+				this.dispatchingThread.ExceptionListener -= this.dispatchingThread_ExceptionHandler;
 				dispatchingThread.Stop(5000);
 				startedAsyncDelivery = false;
 			}
@@ -603,8 +614,12 @@
 				dispatcher.SetAsyncDelivery(dispatchingThread.EventHandle);
 			}
 
-			dispatchingThread.Start();
-			startedAsyncDelivery = true;
+			if(!startedAsyncDelivery)
+			{
+				this.dispatchingThread.ExceptionListener += this.dispatchingThread_ExceptionHandler;
+				dispatchingThread.Start();
+				startedAsyncDelivery = true;
+			}
 		}
 	}
 }

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/CommonAssemblyInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/CommonAssemblyInfo.cs?rev=687504&r1=687503&r2=687504&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/CommonAssemblyInfo.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/CommonAssemblyInfo.cs
Wed Aug 20 16:25:00 2008
@@ -5,7 +5,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:2.0.50727.1433
+//     Runtime Version:2.0.50727.3053
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.

Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/CommonAssemblyInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/CommonAssemblyInfo.cs?rev=687504&r1=687503&r2=687504&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/CommonAssemblyInfo.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/CommonAssemblyInfo.cs Wed Aug
20 16:25:00 2008
@@ -5,7 +5,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:2.0.50727.1433
+//     Runtime Version:2.0.50727.3053
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.

Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs?rev=687504&r1=687503&r2=687504&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs Wed Aug
20 16:25:00 2008
@@ -66,35 +66,48 @@
 			IDestination destination = null;
 			DestinationType destinationType = defaultType;
 
-			if(0 == String.Compare(destinationName.Substring(0, QueuePrefix.Length), QueuePrefix,
false))
+			if(null != destinationName)
 			{
-				destinationType = DestinationType.Queue;
-				destinationName = destinationName.Substring(QueuePrefix.Length);
-			}
-			else if(0 == String.Compare(destinationName.Substring(0, TopicPrefix.Length), TopicPrefix,
false))
-			{
-				destinationType = DestinationType.Topic;
-				destinationName = destinationName.Substring(TopicPrefix.Length);
-			}
-			else if(0 == String.Compare(destinationName.Substring(0, TempQueuePrefix.Length), TempQueuePrefix,
false))
-			{
-				destinationType = DestinationType.TemporaryQueue;
-				destinationName = destinationName.Substring(TempQueuePrefix.Length);
-			}
-			else if(0 == String.Compare(destinationName.Substring(0, TempTopicPrefix.Length), TempTopicPrefix,
false))
-			{
-				destinationType = DestinationType.TemporaryTopic;
-				destinationName = destinationName.Substring(TempTopicPrefix.Length);
+				if(destinationName.Length > QueuePrefix.Length
+					&& 0 == String.Compare(destinationName.Substring(0, QueuePrefix.Length), QueuePrefix,
false))
+				{
+					destinationType = DestinationType.Queue;
+					destinationName = destinationName.Substring(QueuePrefix.Length);
+				}
+				else if(destinationName.Length > TopicPrefix.Length
+					&& 0 == String.Compare(destinationName.Substring(0, TopicPrefix.Length), TopicPrefix,
false))
+				{
+					destinationType = DestinationType.Topic;
+					destinationName = destinationName.Substring(TopicPrefix.Length);
+				}
+				else if(destinationName.Length > TempQueuePrefix.Length
+					&& 0 == String.Compare(destinationName.Substring(0, TempQueuePrefix.Length),
TempQueuePrefix, false))
+				{
+					destinationType = DestinationType.TemporaryQueue;
+					destinationName = destinationName.Substring(TempQueuePrefix.Length);
+				}
+				else if(destinationName.Length > TempTopicPrefix.Length
+					&& 0 == String.Compare(destinationName.Substring(0, TempTopicPrefix.Length),
TempTopicPrefix, false))
+				{
+					destinationType = DestinationType.TemporaryTopic;
+					destinationName = destinationName.Substring(TempTopicPrefix.Length);
+				}
 			}
 
 			switch(destinationType)
 			{
 			case DestinationType.Queue:
-				destination = session.GetQueue(destinationName);
+				if(null != destinationName)
+				{
+					destination = session.GetQueue(destinationName);
+				}
 			break;
 
 			case DestinationType.Topic:
-				destination = session.GetTopic(destinationName);
+				if(null != destinationName)
+				{
+					destination = session.GetTopic(destinationName);
+				}
 			break;
 
 			case DestinationType.TemporaryQueue:

Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/CommonAssemblyInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/CommonAssemblyInfo.cs?rev=687504&r1=687503&r2=687504&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/CommonAssemblyInfo.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/CommonAssemblyInfo.cs Wed Aug
20 16:25:00 2008
@@ -5,7 +5,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:2.0.50727.1433
+//     Runtime Version:2.0.50727.3053
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.



Mime
View raw message