Example #1
0
 // for test only
 internal RoundRobinLoadBalancer(
     IClusterConnectionPool clusterConnPool,
     RoundRobinClusterView clusterView)
 {
     _clusterConnectionPool = clusterConnPool;
     _clusterView           = clusterView;
     _logger = null;
 }
Example #2
0
        internal void EnsureDiscovery()
        {
            lock (_syncLock)
            {
                if (!_clusterView.IsStale())
                {
                    return;
                }

                var newView = NewClusterView();
                _clusterConnectionPool.Update(newView.All());
                _clusterView = newView;
            }
        }
Example #3
0
        public RoundRobinLoadBalancer(
            Uri seedServer,
            IAuthToken authToken,
            EncryptionManager encryptionManager,
            ConnectionPoolSettings poolSettings,
            ILogger logger)
        {
            _clusterConnectionPool = new ClusterConnectionPool(
                seedServer, authToken, encryptionManager,
                poolSettings, logger, CreateClusterPooledConnectionErrorHandler);

            _stopwatch   = new Stopwatch();
            _clusterView = new RoundRobinClusterView(seedServer, _stopwatch);

            _logger = logger;
        }
Example #4
0
        protected virtual void Dispose(bool isDisposing)
        {
            if (!isDisposing)
            {
                return;
            }

            _clusterView = null;

            if (_clusterConnectionPool != null)
            {
                _clusterConnectionPool.Dispose();
                _clusterConnectionPool = null;
            }
            _logger = null;
        }