activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgo...@apache.org
Subject svn commit: r1478992 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs
Date Fri, 03 May 2013 22:33:41 GMT
Author: jgomes
Date: Fri May  3 22:33:41 2013
New Revision: 1478992

URL: http://svn.apache.org/r1478992
Log:
Fix race condition. Don't throw an exception when checking for connection closed if the RequestTimeout
is set to infinite.

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.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=1478992&r1=1478991&r2=1478992&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 Fri May
 3 22:33:41 2013
@@ -37,6 +37,7 @@ namespace Apache.NMS.ActiveMQ
 	public class Connection : IConnection
 	{
 		private static readonly IdGenerator CONNECTION_ID_GENERATOR = new IdGenerator();
+		private static readonly TimeSpan InfiniteTimeSpan = TimeSpan.FromMilliseconds(Timeout.Infinite);
 
 		// Uri configurable options.
 		private AcknowledgementMode acknowledgementMode = AcknowledgementMode.AutoAcknowledge;
@@ -64,7 +65,7 @@ namespace Apache.NMS.ActiveMQ
 		private readonly Uri brokerUri;
 		private ITransport transport;
 		private readonly ConnectionInfo info;
-		private TimeSpan requestTimeout; // from connection factory
+		private TimeSpan requestTimeout = NMSConstants.defaultRequestTimeout; // from connection
factory
 		private BrokerInfo brokerInfo; // from broker
 		private readonly CountDownLatch brokerInfoReceived = new CountDownLatch(1);
 		private WireFormatInfo brokerWireFormatInfo; // from broker
@@ -1011,7 +1012,8 @@ namespace Apache.NMS.ActiveMQ
 						}
 					}
 
-					if(connected.Value || closed.Value || closing.Value || DateTime.Now > timeoutTime)
+					if(connected.Value || closed.Value || closing.Value
+						|| (DateTime.Now > timeoutTime && this.RequestTimeout != InfiniteTimeSpan))
 					{
 						break;
 					}



Mime
View raw message