Exemplo n.º 1
0
        /// <summary>Add all nodes from a dependent nodes list to excludedNodes.</summary>
        /// <returns>number of new excluded nodes</returns>
        private int AddDependentNodesToExcludedNodes(DatanodeDescriptor chosenNode, ICollection
                                                     <Node> excludedNodes)
        {
            if (this.host2datanodeMap == null)
            {
                return(0);
            }
            int countOfExcludedNodes = 0;

            foreach (string hostname in chosenNode.GetDependentHostNames())
            {
                DatanodeDescriptor node = this.host2datanodeMap.GetDataNodeByHostName(hostname);
                if (node != null)
                {
                    if (excludedNodes.AddItem(node))
                    {
                        countOfExcludedNodes++;
                    }
                }
                else
                {
                    Log.Warn("Not able to find datanode " + hostname + " which has dependency with datanode "
                             + chosenNode.GetHostName());
                }
            }
            return(countOfExcludedNodes);
        }