Repository: qpid-jms
Updated Branches:
  refs/heads/master ded00c7a9 -> d4d4d709b


Don't try to connect if we already hit the limit in a previously queued
connect task

Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/d4d4d709
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/d4d4d709
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/d4d4d709

Branch: refs/heads/master
Commit: d4d4d709b9db340604853e21f00881772817871f
Parents: ded00c7
Author: Timothy Bish <tabish...@gmail.com>
Authored: Mon Jan 12 12:32:55 2015 -0500
Committer: Timothy Bish <tabish...@gmail.com>
Committed: Mon Jan 12 12:32:55 2015 -0500

----------------------------------------------------------------------
 .../apache/qpid/jms/provider/failover/FailoverProvider.java | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/d4d4d709/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java
----------------------------------------------------------------------
diff --git 
a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java
 
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java
index 256d635..4fa7269 100644
--- 
a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java
+++ 
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/failover/FailoverProvider.java
@@ -532,8 +532,11 @@ public class FailoverProvider extends 
DefaultProviderListener implements Provide
                     return;
                 }
 
-                // TODO: if this is already at/past the limit when we arrive, 
we should
-                // stop here rather than initialise the provider and only fail 
(again) after.
+                int reconnectLimit = reconnectAttemptLimit();
+                if (reconnectLimit != UNLIMITED && reconnectAttempts >= 
reconnectLimit) {
+                    return;
+                }
+
                 reconnectAttempts++;
                 Throwable failure = null;
                 URI target = uris.getNext();
@@ -550,8 +553,6 @@ public class FailoverProvider extends 
DefaultProviderListener implements Provide
                     }
                 }
 
-                int reconnectLimit = reconnectAttemptLimit();
-
                 if (reconnectLimit != UNLIMITED && reconnectAttempts >= 
reconnectLimit) {
                     LOG.error("Failed to connect after: " + reconnectAttempts 
+ " attempt(s)");
                     failed.set(true);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to