Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 54304 invoked from network); 29 Dec 2010 13:35:42 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Dec 2010 13:35:42 -0000 Received: (qmail 52321 invoked by uid 500); 29 Dec 2010 13:35:41 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 52256 invoked by uid 500); 29 Dec 2010 13:35:39 -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 52249 invoked by uid 99); 29 Dec 2010 13:35:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Dec 2010 13:35:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.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; Wed, 29 Dec 2010 13:35:38 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id BB86423889DA; Wed, 29 Dec 2010 13:35:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1053632 - /activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs Date: Wed, 29 Dec 2010 13:35:18 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101229133518.BB86423889DA@eris.apache.org> Author: tabish Date: Wed Dec 29 13:35:18 2010 New Revision: 1053632 URL: http://svn.apache.org/viewvc?rev=1053632&view=rev Log: Apply patch for: https://issues.apache.org/jira/browse/AMQNET-300 Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs Modified: activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs?rev=1053632&r1=1053631&r2=1053632&view=diff ============================================================================== --- activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs (original) +++ activemq/activemq-dotnet/Apache.NMS.Stomp/trunk/src/main/csharp/Transport/Failover/FailoverTransport.cs Wed Dec 29 13:35:18 2010 @@ -61,6 +61,7 @@ namespace Apache.NMS.Stomp.Transport.Fai private bool useExponentialBackOff = true; private bool randomize = true; private int maxReconnectAttempts; + private int startupMaxReconnectAttempts; private int connectFailures; private int reconnectDelay = 10; private Exception connectionFailure; @@ -196,6 +197,12 @@ namespace Apache.NMS.Stomp.Transport.Fai set { maxReconnectAttempts = value; } } + public int StartupMaxReconnectAttempts + { + get { return startupMaxReconnectAttempts; } + set { startupMaxReconnectAttempts = value; } + } + public bool Randomize { get { return randomize; } @@ -824,7 +831,17 @@ namespace Apache.NMS.Stomp.Transport.Fai } } - if(MaxReconnectAttempts > 0 && ++connectFailures >= MaxReconnectAttempts) + int maxAttempts = 0; + if( firstConnection ) { + if( StartupMaxReconnectAttempts != 0 ) { + maxAttempts = StartupMaxReconnectAttempts; + } + } + if( maxAttempts == 0 ) { + maxAttempts = MaxReconnectAttempts; + } + + if(maxAttempts > 0 && ++connectFailures >= maxAttempts) { Tracer.ErrorFormat("Failed to connect to transport after {0} attempt(s)", connectFailures); connectionFailure = Failure;