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:40:24 UTC
svn commit: r1311395 - in
/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src:
main/csharp/Connection.cs
test/csharp/Transport/failover/FailoverTransportTest.cs
Author: jgomes
Date: Mon Apr 9 19:40:24 2012
New Revision: 1311395
URL: http://svn.apache.org/viewvc?rev=1311395&view=rev
Log:
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/branches/1.5.x/src/main/csharp/Connection.cs
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/test/csharp/Transport/failover/FailoverTransportTest.cs
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Connection.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Connection.cs?rev=1311395&r1=1311394&r2=1311395&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Connection.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/main/csharp/Connection.cs Mon Apr 9 19:40:24 2012
@@ -444,7 +444,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/branches/1.5.x/src/test/csharp/Transport/failover/FailoverTransportTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/test/csharp/Transport/failover/FailoverTransportTest.cs?rev=1311395&r1=1311394&r2=1311395&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/test/csharp/Transport/failover/FailoverTransportTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/branches/1.5.x/src/test/csharp/Transport/failover/FailoverTransportTest.cs Mon Apr 9 19:40:24 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;
}