Exemple #1
0
        // for test only
        internal LoadBalancer(
            IClusterConnectionPool clusterConnPool,
            IRoutingTableManager routingTableManager)
        {
            _clusterConnectionPool = clusterConnPool;
            _routingTableManager   = routingTableManager;
            var config = Config.DefaultConfig;

            _loadBalancingStrategy = CreateLoadBalancingStrategy(config.LoadBalancingStrategy, clusterConnPool, config.Logger);
        }
Exemple #2
0
        public LoadBalancer(
            IPooledConnectionFactory connectionFactory,
            RoutingSettings routingSettings,
            ConnectionPoolSettings poolSettings,
            IDriverLogger logger)
        {
            _logger = logger;

            _clusterConnectionPool = new ClusterConnectionPool(Enumerable.Empty <Uri>(), connectionFactory, poolSettings, logger);
            _routingTableManager   = new RoutingTableManager(routingSettings, this, logger);
            _loadBalancingStrategy = CreateLoadBalancingStrategy(routingSettings.Strategy, _clusterConnectionPool, _logger);
        }
Exemple #3
0
        public LoadBalancer(
            IPooledConnectionFactory connectionFactory,
            RoutingSettings routingSettings,
            ConnectionPoolSettings poolSettings,
            ILogger logger)
        {
            _logger = logger;
            var uris = routingSettings.InitialServers;

            _clusterConnectionPool = new ClusterConnectionPool(uris, connectionFactory, poolSettings, logger);
            _routingTableManager   = new RoutingTableManager(routingSettings, this, logger);

            _loadBalancingStrategy = CreateLoadBalancingStrategy(routingSettings.Strategy, _clusterConnectionPool, logger);
        }
Exemple #4
0
        public LoadBalancer(
            IPooledConnectionFactory connectionFactory,
            RoutingSettings routingSettings,
            ConnectionPoolSettings poolSettings,
            ILogger logger)
        {
            _logger = logger;

            _clusterConnectionPool =
                new ClusterConnectionPool(Enumerable.Empty <Uri>(), connectionFactory, poolSettings, logger);
            _routingTableManager          = new RoutingTableManager(routingSettings, this, logger);
            _loadBalancingStrategy        = CreateLoadBalancingStrategy(_clusterConnectionPool, _logger);
            _initialServerAddressProvider = routingSettings.InitialServerAddressProvider;
        }