Amazon.ElastiCacheCluster/Pools/AutoServerPool.cs
/// <summary>
/// Used to update the servers for Auto discovery
/// </summary>
/// <param name="endPoints">The connections to all the cluster nodes</param>
Used to update the servers for Auto discovery
Used to update the servers for Auto discovery
public void UpdateLocator(List<IPEndPoint> endPoints)
        {
            var newLocator = this.configuration.CreateNodeLocator();
            var nodes = endPoints.Select(ip =>
            {
                var node = this.CreateNode(ip);
                node.Failed += this.NodeFail;
                return node;
            }).ToArray();
            var aliveList = new List<IMemcachedNode>(nodes.Length);
            var deadList = new List<IMemcachedNode>(nodes.Length);
            foreach (var node in nodes)
            {
                var result = this.allNodes.Where(n => n.EndPoint.Equals(node.EndPoint)).ToList();
                if (result.Count > 0 && !result[0].IsAlive)
                {
                    deadList.Add(result[0]);
                    continue;
                }
                aliveList.Add(node);
            }
            newLocator.Initialize(aliveList);
            var allNodesList = new List<IMemcachedNode>(nodes.Length);
            allNodesList.AddRange(aliveList);
            allNodesList.AddRange(deadList);
            this.allNodes = allNodesList.ToArray();
            Interlocked.Exchange(ref this.nodeLocator, newLocator);
        }
public void UpdateLocator ( List < IPEndPoint > endPoints ) { var newLocator = this . configuration . CreateNodeLocator ( ) ; var nodes = endPoints . Select ( ip => { var node = this . CreateNode ( ip ) ; node . Failed += this . NodeFail ; return node ; } ) . ToArray ( ) ; var aliveList = new List < IMemcachedNode > ( nodes . Length ) ; var deadList = new List < IMemcachedNode > ( nodes . Length ) ; foreach ( var node in nodes ) { var result = this . allNodes . Where ( n => n . EndPoint . Equals ( node . EndPoint ) ) . ToList ( ) ; if ( result . Count > 0 && ! result [ 0 ] . IsAlive ) { deadList . Add ( result [ 0 ] ) ; continue ; } aliveList . Add ( node ) ; } newLocator . Initialize ( aliveList ) ; var allNodesList = new List < IMemcachedNode > ( nodes . Length ) ; allNodesList . AddRange ( aliveList ) ; allNodesList . AddRange ( deadList ) ; this . allNodes = allNodesList . ToArray ( ) ; Interlocked . Exchange ( ref this . nodeLocator , newLocator ) ; }
Used to update the servers for Auto discovery
Used to update the servers for Auto discovery
// Retain All Nodes List With IsAlive Status
endPoints
List<IPEndPoint>
The connections to all the cluster nodes
The connections to all the cluster nodes