/** * Returned information is a JSON representation of map with host name as the * key and value is a map of dead node attribute keys to its values */ @Override // NameNodeMXBean public String getDeadNodes() { final Map<String, Map<String, Object>> info = new HashMap<String, Map<String, Object>>(); final ArrayList<DatanodeDescriptor> liveNodeList = new ArrayList<DatanodeDescriptor>(); final ArrayList<DatanodeDescriptor> deadNodeList = new ArrayList<DatanodeDescriptor>(); // we need to call DFSNodeStatus to filter out the dead data nodes DFSNodesStatus(liveNodeList, deadNodeList); removeDecommissionedNodeFromList(deadNodeList); for (DatanodeDescriptor node : deadNodeList) { final Map<String, Object> innerinfo = new HashMap<String, Object>(); innerinfo.put("lastContact", getLastContact(node)); innerinfo.put("decommissioned", node.isDecommissioned()); innerinfo.put("excluded", this.inExcludedHostsList(node, null)); info.put(node.getHostName() + ":" + node.getPort(), innerinfo); } return JSON.toString(info); }
/** * Returned information is a JSON representation of map with host name as the * key and value is a map of decomisioning node attribute keys to its values */ @Override // NameNodeMXBean public String getDecomNodes() { final Map<String, Map<String, Object>> info = new HashMap<String, Map<String, Object>>(); final ArrayList<DatanodeDescriptor> decomNodeList = this.getDecommissioningNodes(); for (DatanodeDescriptor node : decomNodeList) { final Map<String, Object> innerinfo = new HashMap<String, Object>(); innerinfo.put("underReplicatedBlocks", node.decommissioningStatus .getUnderReplicatedBlocks()); innerinfo.put("decommissionOnlyReplicas", node.decommissioningStatus .getDecommissionOnlyReplicas()); innerinfo.put("underReplicateInOpenFiles", node.decommissioningStatus .getUnderReplicatedInOpenFiles()); info.put(node.getHostName() + ":" + node.getPort(), innerinfo); } return JSON.toString(info); }
/** * Returned information is a JSON representation of map with host name as the * key and value is a map of live node attribute keys to its values */ @Override // NameNodeMXBean public String getLiveNodes() { final Map<String, Map<String,Object>> info = new HashMap<String, Map<String,Object>>(); final ArrayList<DatanodeDescriptor> liveNodeList = new ArrayList<DatanodeDescriptor>(); final ArrayList<DatanodeDescriptor> deadNodeList = new ArrayList<DatanodeDescriptor>(); DFSNodesStatus(liveNodeList, deadNodeList); removeDecommissionedNodeFromList(liveNodeList); for (DatanodeDescriptor node : liveNodeList) { final Map<String, Object> innerinfo = new HashMap<String, Object>(); innerinfo.put("lastContact", getLastContact(node)); innerinfo.put("usedSpace", getDfsUsed(node)); innerinfo.put("adminState", node.getAdminState().toString()); innerinfo.put("excluded", this.inExcludedHostsList(node, null)); info.put(node.getHostName() + ":" + node.getPort(), innerinfo); } return JSON.toString(info); }
mustList.remove(dn.getHost()); mustList.remove(dn.getHostName()); mustList.remove(dn.getHostName() + ":" + dn.getPort()); if (!isDead && listLiveNodes && this.inHostsList(dn, null)) { nodes.add(dn);