@Test(timeout=5000) public void testHealthUpdateUnknownNode() { AppContext appContext = mock(AppContext.class); AMNodeMap amNodeMap = new AMNodeMap(eventHandler, appContext); amNodeMap.init(new Configuration(false)); amNodeMap.start(); NodeId nodeId = NodeId.newInstance("unknownhost", 2342); NodeReport nodeReport = generateNodeReport(nodeId, NodeState.UNHEALTHY); amNodeMap.handle(new AMNodeEventStateChanged(nodeReport)); dispatcher.await(); amNodeMap.stop(); }
public void handle(AMNodeEvent rEvent) { NodeId nodeId = rEvent.getNodeId(); switch (rEvent.getType()) { case N_NODE_WAS_BLACKLISTED: addToBlackList(nodeId); computeIgnoreBlacklisting(); break; case N_NODE_COUNT_UPDATED: AMNodeEventNodeCountUpdated event = (AMNodeEventNodeCountUpdated) rEvent; numClusterNodes = event.getNodeCount(); LOG.info("Num cluster nodes = " + numClusterNodes); computeIgnoreBlacklisting(); break; case N_TURNED_UNHEALTHY: case N_TURNED_HEALTHY: AMNode amNode = nodeMap.get(nodeId); if (amNode == null) { LOG.info("Ignoring RM Health Update for unknwon node: " + nodeId); } else { amNode.handle(rEvent); } break; default: nodeMap.get(nodeId).handle(rEvent); } }
AMNodeMap extends AbstractService implements
    EventHandler<AMNodeEvent> { public void handle(AMNodeEvent rEvent) { NodeId nodeId = rEvent.getNodeId(); switch (rEvent.getType()) { case N_NODE_WAS_BLACKLISTED: addToBlackList(nodeId); computeIgnoreBlacklisting(); break; case N_NODE_COUNT_UPDATED: AMNodeEventNodeCountUpdated event = (AMNodeEventNodeCountUpdated) rEvent; numClusterNodes = event.getNodeCount(); LOG.info("Num cluster nodes = " + numClusterNodes); computeIgnoreBlacklisting(); break; case N_TURNED_UNHEALTHY: case N_TURNED_HEALTHY: AMNode amNode = nodeMap.get(nodeId); if (amNode == null) { LOG.info("Ignoring RM Health Update for unknwon node: " + nodeId); } else { amNode.handle(rEvent); } break; default: nodeMap.get(nodeId).handle(rEvent); } } }
AMNodeMap extends AbstractService implements
    EventHandler<AMNodeEvent> { public void handle(AMNodeEvent rEvent) { NodeId nodeId = rEvent.getNodeId(); switch (rEvent.getType()) { case N_NODE_WAS_BLACKLISTED: addToBlackList(nodeId); computeIgnoreBlacklisting(); break; case N_NODE_COUNT_UPDATED: AMNodeEventNodeCountUpdated event = (AMNodeEventNodeCountUpdated) rEvent; numClusterNodes = event.getNodeCount(); LOG.info("Num cluster nodes = " + numClusterNodes); computeIgnoreBlacklisting(); break; case N_TURNED_UNHEALTHY: case N_TURNED_HEALTHY: AMNode amNode = nodeMap.get(nodeId); if (amNode == null) { LOG.info("Ignoring RM Health Update for unknwon node: " + nodeId); } else { amNode.handle(rEvent); } break; default: nodeMap.get(nodeId).handle(rEvent); } } @SuppressWarnings("rawtypes")  AMNodeMap(EventHandler eventHandler, AppContext appContext); }
AMNodeMap extends AbstractService implements
    EventHandler<AMNodeEvent> { public void handle(AMNodeEvent rEvent) { NodeId nodeId = rEvent.getNodeId(); switch (rEvent.getType()) { case N_NODE_WAS_BLACKLISTED: addToBlackList(nodeId); computeIgnoreBlacklisting(); break; case N_NODE_COUNT_UPDATED: AMNodeEventNodeCountUpdated event = (AMNodeEventNodeCountUpdated) rEvent; numClusterNodes = event.getNodeCount(); LOG.info("Num cluster nodes = " + numClusterNodes); computeIgnoreBlacklisting(); break; case N_TURNED_UNHEALTHY: case N_TURNED_HEALTHY: AMNode amNode = nodeMap.get(nodeId); if (amNode == null) { LOG.info("Ignoring RM Health Update for unknwon node: " + nodeId); } else { amNode.handle(rEvent); } break; default: nodeMap.get(nodeId).handle(rEvent); } } @SuppressWarnings("rawtypes")  AMNodeMap(EventHandler eventHandler, AppContext appContext); @Override synchronized void serviceInit(Configuration conf); void nodeSeen(NodeId nodeId); boolean isHostBlackListed(String hostname); void handle(AMNodeEvent rEvent); AMNode get(NodeId nodeId); int size(); @Private @VisibleForTesting boolean isBlacklistingIgnored(); }
AMNodeMap extends AbstractService implements
    EventHandler<AMNodeEvent> { public void handle(AMNodeEvent rEvent) { NodeId nodeId = rEvent.getNodeId(); switch (rEvent.getType()) { case N_NODE_WAS_BLACKLISTED: addToBlackList(nodeId); computeIgnoreBlacklisting(); break; case N_NODE_COUNT_UPDATED: AMNodeEventNodeCountUpdated event = (AMNodeEventNodeCountUpdated) rEvent; numClusterNodes = event.getNodeCount(); LOG.info("Num cluster nodes = " + numClusterNodes); computeIgnoreBlacklisting(); break; case N_TURNED_UNHEALTHY: case N_TURNED_HEALTHY: AMNode amNode = nodeMap.get(nodeId); if (amNode == null) { LOG.info("Ignoring RM Health Update for unknwon node: " + nodeId); } else { amNode.handle(rEvent); } break; default: nodeMap.get(nodeId).handle(rEvent); } } @SuppressWarnings("rawtypes")  AMNodeMap(EventHandler eventHandler, AppContext appContext); @Override synchronized void serviceInit(Configuration conf); void nodeSeen(NodeId nodeId); boolean isHostBlackListed(String hostname); void handle(AMNodeEvent rEvent); AMNode get(NodeId nodeId); int size(); @Private @VisibleForTesting boolean isBlacklistingIgnored();  }