Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 95528 invoked from network); 14 Sep 2009 13:39:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Sep 2009 13:39:57 -0000 Received: (qmail 92872 invoked by uid 500); 14 Sep 2009 13:39:57 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 92814 invoked by uid 500); 14 Sep 2009 13:39:57 -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 92805 invoked by uid 99); 14 Sep 2009 13:39:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Sep 2009 13:39:57 +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; Mon, 14 Sep 2009 13:39:53 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E14F423888CB; Mon, 14 Sep 2009 13:39:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r814638 - /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java Date: Mon, 14 Sep 2009 13:39:32 -0000 To: commits@activemq.apache.org From: rajdavies@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090914133932.E14F423888CB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rajdavies Date: Mon Sep 14 13:39:32 2009 New Revision: 814638 URL: http://svn.apache.org/viewvc?rev=814638&view=rev Log: Fix for https://issues.apache.org/activemq/browse/AMQ-2385 Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java?rev=814638&r1=814637&r2=814638&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java Mon Sep 14 13:39:32 2009 @@ -85,6 +85,7 @@ private boolean randomize = true; private boolean initialized; private int maxReconnectAttempts; + private int startupMaxReconnectAttempts; private int connectFailures; private long reconnectDelay = this.initialReconnectDelay; private Exception connectionFailure; @@ -316,6 +317,14 @@ public void setMaxReconnectAttempts(int maxReconnectAttempts) { this.maxReconnectAttempts = maxReconnectAttempts; } + + public int getStartupMaxReconnectAttempts() { + return this.startupMaxReconnectAttempts; + } + + public void setStartupMaxReconnectAttempts(int startupMaxReconnectAttempts) { + this.startupMaxReconnectAttempts = startupMaxReconnectAttempts; + } public long getTimeout() { return timeout; @@ -753,8 +762,8 @@ } } } - - if (maxReconnectAttempts > 0 && ++connectFailures >= maxReconnectAttempts) { + long reconnectAttempts = firstConnection ? this.startupMaxReconnectAttempts : this.maxReconnectAttempts; + if (reconnectAttempts > 0 && ++connectFailures >= reconnectAttempts) { LOG.error("Failed to connect to transport after: " + connectFailures + " attempt(s)"); connectionFailure = failure;