You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jg...@apache.org on 2012/04/09 21:41:51 UTC

svn commit: r1311397 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk: ./ src/main/csharp/Connection.cs src/test/csharp/Transport/failover/FailoverTransportTest.cs

Author: jgomes
Date: Mon Apr  9 19:41:51 2012
New Revision: 1311397

URL: http://svn.apache.org/viewvc?rev=1311397&view=rev
Log:
Merged revision(s) 1311395 from activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x:
When stopping a connection, it is not necessary, and can cause reconnect problems with failover, to check to see if it is connected.  Remove call to CheckConnected() in Connection.Stop().
........

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/   (props changed)
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/failover/FailoverTransportTest.cs

Propchange: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/
------------------------------------------------------------------------------
  Merged /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x:r1311395

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=1311397&r1=1311396&r2=1311397&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 Mon Apr  9 19:41:51 2012
@@ -446,7 +446,6 @@ namespace Apache.NMS.ActiveMQ
 		/// </summary>
 		public void Stop()
 		{
-			CheckConnected();
 			if(started.CompareAndSet(true, false))
 			{
 				lock(sessions.SyncRoot)

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/failover/FailoverTransportTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/failover/FailoverTransportTest.cs?rev=1311397&r1=1311396&r2=1311397&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/failover/FailoverTransportTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/Transport/failover/FailoverTransportTest.cs Mon Apr  9 19:41:51 2012
@@ -682,7 +682,39 @@ namespace Apache.NMS.ActiveMQ.Test
             Assert.IsTrue(this.resumed);
         }
 
-        public void TransportInterrupted()
+		[Test]
+		public void FailStartupMaxReconnectAttempts()
+		{
+			// Connect to valid machine, but on invalid port that doesn't have a broker listening.
+			string uri = "failover:(tcp://localhost:31313)?transport.StartupMaxReconnectAttempts=3";
+			IConnectionFactory factory = new ConnectionFactory(NMSTestSupport.ReplaceEnvVar(uri));
+			IConnection failConnection = factory.CreateConnection();
+			try
+			{
+				failConnection.Start();
+				Assert.Fail("Should not have connected to broker.");
+			}
+			catch(Apache.NMS.ActiveMQ.ConnectionClosedException)
+			{
+			}
+			finally
+			{
+				try
+				{
+					failConnection.Stop();
+				}
+				catch(Apache.NMS.ActiveMQ.ConnectionClosedException)
+				{
+                    Assert.Fail("Connection closed exception thrown while closing a connection.");
+				}
+				finally
+				{
+					failConnection.Dispose();
+				}
+			}
+		}
+		
+		public void TransportInterrupted()
         {
             this.interrupted = true;
         }