Example #1
0
 internal void MarkAsDownAndScheduleReconnection(Host host, HostConnectionPool pool)
 {
     // By setting the host as down, all pools should cancel any outstanding reconnection attempt
     if (host.SetDown())
     {
         // Only attempt reconnection with 1 connection pool
         pool.ScheduleReconnection();
     }
 }
Example #2
0
 internal void OnAllConnectionClosed(Host host, HostConnectionPool pool)
 {
     if (_cluster.AnyOpenConnections(host))
     {
         pool.ScheduleReconnection();
         return;
     }
     // There isn't any open connection to this host in any of the pools
     MarkAsDownAndScheduleReconnection(host, pool);
 }
Example #3
0
        /// <summary>
        /// Gets or creates the connection pool for a given host
        /// </summary>
        internal HostConnectionPool GetOrCreateConnectionPool(Host host, HostDistance distance)
        {
            var hostPool = _connectionPool.GetOrAdd(host.Address, address =>
            {
                var newPool = new HostConnectionPool(host, Configuration, _serializer);
                newPool.AllConnectionClosed += OnAllConnectionClosed;
                newPool.SetDistance(distance);
                return(newPool);
            });

            return(hostPool);
        }
Example #4
0
 public HostStateInfo(HostConnectionPool pool)
 {
     OpenConnections = pool.OpenConnections;
     InFlightQueries = pool.InFlight;
 }