Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9D5581079B for ; Fri, 3 May 2013 22:34:02 +0000 (UTC) Received: (qmail 24053 invoked by uid 500); 3 May 2013 22:34:02 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 23973 invoked by uid 500); 3 May 2013 22:34:02 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 23966 invoked by uid 99); 3 May 2013 22:34:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 May 2013 22:34:02 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 May 2013 22:34:01 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 792D02388ABA; Fri, 3 May 2013 22:33:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1478992 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/Connection.cs Date: Fri, 03 May 2013 22:33:41 -0000 To: commits@activemq.apache.org From: jgomes@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130503223341.792D02388ABA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; }