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(); } }
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); }
/// <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); }
public HostStateInfo(HostConnectionPool pool) { OpenConnections = pool.OpenConnections; InFlightQueries = pool.InFlight; }