/// <summary>
        /// Gets a list of all opened connections to all hosts
        /// </summary>
        private List <Connection> GetAllConnections()
        {
            var hosts       = Cluster.AllHosts();
            var connections = new List <Connection>();

            foreach (var host in hosts)
            {
                HostConnectionPool pool;
                if (_connectionPool.TryGetValue(host.Address, out pool))
                {
                    connections.AddRange(pool.OpenConnections);
                }
            }
            return(connections);
        }
        /// <inheritdoc />
        public void Dispose()
        {
            //Only dispose once
            if (Interlocked.Increment(ref _disposed) != 1)
            {
                return;
            }
            var hosts = Cluster.AllHosts().ToArray();

            foreach (var host in hosts)
            {
                HostConnectionPool pool;
                if (_connectionPool.TryGetValue(host.Address, out pool))
                {
                    pool.Dispose();
                }
            }
        }
        /// <summary>
        /// Gets a list of all opened connections to all hosts
        /// </summary>
        private List <Connection> GetAllConnections()
        {
            var hosts       = Cluster.AllHosts();
            var connections = new List <Connection>();

            foreach (var host in hosts)
            {
                if (!host.IsUp)
                {
                    continue;
                }
                var distance = this.Policies.LoadBalancingPolicy.Distance(host);
                var hostPool = this.GetConnectionPool(host, distance);
                foreach (var c in hostPool.OpenConnections)
                {
                    connections.Add(c);
                }
            }
            return(connections);
        }