[ 
https://issues.apache.org/jira/browse/ARTEMIS-2835?focusedWorklogId=456143&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-456143
 ]

ASF GitHub Bot logged work on ARTEMIS-2835:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Jul/20 13:55
            Start Date: 08/Jul/20 13:55
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on a change in pull request 
#3211:
URL: https://github.com/apache/activemq-artemis/pull/3211#discussion_r451563260



##########
File path: 
artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java
##########
@@ -682,12 +689,32 @@ public ClientSessionFactory createSessionFactory() throws 
ActiveMQException {
                try {
                   if (e.getType() == ActiveMQExceptionType.NOT_CONNECTED) {
                      attempts++;
-
-                     int connectorsSize = getConnectorsSize();
                      int maxAttempts = config.initialConnectAttempts == 0 ? 1 
: config.initialConnectAttempts;
 
-                     if (config.initialConnectAttempts >= 0 && attempts >= 
maxAttempts * connectorsSize) {
-                        throw 
ActiveMQClientMessageBundle.BUNDLE.cannotConnectToServers();
+                     if (shouldTryStatic) {
+                        //we know static is used
+                        if (config.initialConnectAttempts >= 0 && attempts >= 
maxAttempts * this.getNumInitialConnectors()) {
+                           if (topologyArrayTried) {
+                              //stop retry and throw exception
+                              throw 
ActiveMQClientMessageBundle.BUNDLE.cannotConnectToServers();
+                           } else {
+                              //lets try topologyArray
+                              staticTried = true;
+                              shouldTryStatic = false;
+                              attempts = 0;
+                           }
+                        }
+                     } else {
+                        //we know topologyArray is used
+                        if (config.initialConnectAttempts >= 0 && attempts >= 
maxAttempts * getConnectorsSize()) {
+                           if (staticTried) {
+                              throw 
ActiveMQClientMessageBundle.BUNDLE.cannotConnectToServers();
+                           } else {
+                              topologyArrayTried = true;
+                              shouldTryStatic = true;
+                              attempts = 0;
+                           }
+                        }
                      }
                      if (factory.waitForRetry(config.retryInterval)) {

Review comment:
       thanks @gaohoward 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 456143)
    Time Spent: 1h 40m  (was: 1.5h)

> Porting HORNETQ-1575 and HORNETQ-1578
> -------------------------------------
>
>                 Key: ARTEMIS-2835
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2835
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 2.13.0
>            Reporter: Howard Gao
>            Assignee: Howard Gao
>            Priority: Major
>             Fix For: 2.14.0
>
>          Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> The HORNETQ-1575 and HORNETQ-1578 bug fixes are not available in Artemis. It 
> could be hit by users in Artemis too.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to