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 2009/06/08 17:10:13 UTC

svn commit: r782665 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src: main/csharp/Transport/Failover/FailoverTransport.cs test/csharp/NMSConnectionFactoryTest.cs

Author: tabish
Date: Mon Jun  8 15:10:13 2009
New Revision: 782665

URL: http://svn.apache.org/viewvc?rev=782665&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQNET-160

Back out the logic in the Failover Transport to fail if a connection isn't established on startup.

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs?rev=782665&r1=782664&r2=782665&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs Mon Jun  8 15:10:13 2009
@@ -102,7 +102,7 @@
 					parent.backupMutex.WaitOne();
 					if(parent.ConnectedTransport == null && doReconnect)
 					{
-						result = parent.doConnect(true);
+						result = parent.doConnect();
 						buildBackup = false;
 					}
 				}
@@ -278,11 +278,7 @@
 				}
 				else
 				{
-					doConnect(false);
-					if(ConnectedTransport == null)
-					{
-						throw new NMSConnectionException("Error creating initial connection.");
-					}
+					doConnect();
 				}
 			}
 			finally
@@ -750,7 +746,7 @@
 			get { return true; }
 		}
 
-		private bool doConnect(bool reconnecting)
+		private bool doConnect()
 		{
 			Exception failure = null;
 			try
@@ -796,6 +792,7 @@
 									ConnectedTransportURI = uri;
 									ConnectedTransport = t;
 									connectFailures = 0;
+                                    connected = true;
 									Tracer.InfoFormat("Successfully reconnected to backup {0}", uri.ToString());
 									return false;
 								}
@@ -872,7 +869,7 @@
 				reconnectMutex.ReleaseMutex();
 			}
 
-			if(!disposed && reconnecting)
+			if(!disposed)
 			{
 
 				Tracer.DebugFormat("Waiting {0}ms before attempting connection.", ReconnectDelay);

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs?rev=782665&r1=782664&r2=782665&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs Mon Jun  8 15:10:13 2009
@@ -1,18 +1,18 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 using System;
@@ -38,17 +38,12 @@
 		[Row("tcp://InvalidHost:61616", ExpectedException = typeof(NMSConnectionException))]
 		[Row("activemq:tcp://InvalidHost:61616", ExpectedException = typeof(NMSConnectionException))]
 		[Row("activemq:tcp://InvalidHost:61616?connection.asyncclose=false", ExpectedException = typeof(NMSConnectionException))]
-		[Row("activemq:failover:tcp://InvalidHost:61616", ExpectedException = typeof(NMSConnectionException))]
-		[Row("activemq:failover:(tcp://InvalidHost:61616)", ExpectedException = typeof(NMSConnectionException))]
-		[Row("activemq:failover:(tcp://InvalidHost:61616,tcp://InvalidHost:61616)", ExpectedException = typeof(NMSConnectionException))]
 
 		[Row("tcp://${activemqhost}:61616?connection.InvalidParameter=true", ExpectedException = typeof(NMSException))]
 		[Row("activemq:tcp://${activemqhost}:61616?connection.InvalidParameter=true", ExpectedException = typeof(NMSException))]
 		[Row("activemq:failover:tcp://${activemqhost}:61616?connection.InvalidParameter=true", ExpectedException = typeof(NMSException))]
 		[Row("activemq:failover:(tcp://${activemqhost}:61616)?connection.InvalidParameter=true", ExpectedException = typeof(NMSException))]
-		[Row("activemq:failover:(tcp://${activemqhost}:61616?transport.InvalidParameter=true)", ExpectedException = typeof(NMSConnectionException))]
 		[Row("activemq:failover:(tcp://${activemqhost}:61616,tcp://${activemqbackuphost}:61616)?connection.InvalidParameter=true", ExpectedException = typeof(NMSException))]
-		[Row("activemq:failover:(tcp://${activemqhost}:61616?transport.InvalidParameter=true,tcp://${activemqbackuphost}:61616)", ExpectedException = typeof(NMSConnectionException))]
 
 		[Row("ftp://${activemqhost}:61616", ExpectedException = typeof(NMSConnectionException))]
 		[Row("http://${activemqhost}:61616", ExpectedException = typeof(NMSConnectionException))]