示例#1
0
        public static IList <RMNode> QueryRMNodes(RMContext context, EnumSet <NodeState> acceptedStates
                                                  )
        {
            // nodes contains nodes that are NEW, RUNNING OR UNHEALTHY
            AList <RMNode> results = new AList <RMNode>();

            if (acceptedStates.Contains(NodeState.New) || acceptedStates.Contains(NodeState.Running
                                                                                  ) || acceptedStates.Contains(NodeState.Unhealthy))
            {
                foreach (RMNode rmNode in context.GetRMNodes().Values)
                {
                    if (acceptedStates.Contains(rmNode.GetState()))
                    {
                        results.AddItem(rmNode);
                    }
                }
            }
            // inactiveNodes contains nodes that are DECOMMISSIONED, LOST, OR REBOOTED
            if (acceptedStates.Contains(NodeState.Decommissioned) || acceptedStates.Contains(
                    NodeState.Lost) || acceptedStates.Contains(NodeState.Rebooted))
            {
                foreach (RMNode rmNode in context.GetInactiveRMNodes().Values)
                {
                    if (acceptedStates.Contains(rmNode.GetState()))
                    {
                        results.AddItem(rmNode);
                    }
                }
            }
            return(results);
        }