[ 
https://issues.apache.org/jira/browse/ARTEMIS-546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15307591#comment-15307591
 ] 

Miroslav Novak commented on ARTEMIS-546:
----------------------------------------

Looking at the code in {{ServerLocatorImpl.selectConnector()}}, I'm not sure if 
use of {{loadBalancingPolicy}} when {{usedTopology}} is {{null}} is valid as we 
should iterate over them everytime. Currently we iterate over them because 
round robin policy is used by default.

{code}
private TransportConfiguration selectConnector() {
      Pair<TransportConfiguration, TransportConfiguration>[] usedTopology;

      synchronized (topologyArrayGuard) {
         usedTopology = topologyArray;
      }

      synchronized (this) {
         // if the topologyArray is null, we will use the initialConnectors
         if (usedTopology != null) {
            if (logger.isTraceEnabled()) {
               logger.trace("Selecting connector from toplogy.");
            }
            int pos = loadBalancingPolicy.select(usedTopology.length);
            Pair<TransportConfiguration, TransportConfiguration> pair = 
usedTopology[pos];

            return pair.getA();
         }
         else {
            // Get from initialconnectors
            if (logger.isTraceEnabled()) {
               logger.trace("Selecting connector from initial connectors.");
            }

            int pos = loadBalancingPolicy.select(initialConnectors.length);

            return initialConnectors[pos];
         }
      }
   }
{code}

> Allow to disable client-side load-balancing
> -------------------------------------------
>
>                 Key: ARTEMIS-546
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-546
>             Project: ActiveMQ Artemis
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 1.3.0
>            Reporter: Miroslav Novak
>
> In case when user wants to define client side load-balancing on its own and 
> for each client specify connector to node in cluster to which it must connect 
> then there is no way do it by current load-balancing policies.
> Interface {{ConnectionLoadBalancingPolicy}} does not allow to say to which 
> node to connect based on connector information which was used in 
> configuration connection factory. 
> Idea is to allow to disable load-balancing policy. When load-balancing policy 
> is disabled then it will iterate through initial connectors (in sequence as 
> they were configured) to create connection to remote broker. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to