public static DatanodeStatus getDatanodeStats(FSNamesystem ns,
      ArrayList<DatanodeDescriptor> live, ArrayList<DatanodeDescriptor> dead) {
    ns.DFSNodesStatus(live, dead);
    ArrayList<DatanodeDescriptor> decommissioning = ns
        .getDecommissioningNodesList(live);

    // live nodes
    int numLive = live.size();
    int numLiveExcluded = 0;
    int numLiveDecommissioningInProgress = decommissioning.size();
    int numLiveDecommissioned = 0;

    for (DatanodeDescriptor d : live) {
      numLiveDecommissioned += d.isDecommissioned() ? 1 : 0;
      numLiveExcluded += ns.inExcludedHostsList(d, null) ? 1 : 0;
    }

    // dead nodes
    int numDead = dead.size();
    int numDeadExcluded = 0;
    int numDeadDecommissioningNotCompleted = 0;
    int numDeadDecommissioned = 0;

    for (DatanodeDescriptor d : dead) {
      numDeadDecommissioned += d.isDecommissioned() ? 1 : 0;
      numDeadExcluded += ns.inExcludedHostsList(d, null) ? 1 : 0;
    }

    numDeadDecommissioningNotCompleted = numDeadExcluded - numDeadDecommissioned;

    return new DatanodeStatus(numLive, 
        numLiveExcluded,
        numLiveDecommissioningInProgress, 
        numLiveDecommissioned, 
        numDead,
        numDeadExcluded, 
        numDeadDecommissioningNotCompleted,
        numDeadDecommissioned);
  }
public static DatanodeStatus getDatanodeStats ( FSNamesystem ns , ArrayList < DatanodeDescriptor > live , ArrayList < DatanodeDescriptor > dead ) { ns . DFSNodesStatus ( live , dead ) ; ArrayList < DatanodeDescriptor > decommissioning = ns . getDecommissioningNodesList ( live ) ; int numLive = live . size ( ) ; int numLiveExcluded = 0 ; int numLiveDecommissioningInProgress = decommissioning . size ( ) ; int numLiveDecommissioned = 0 ; for ( DatanodeDescriptor d : live ) { numLiveDecommissioned += d . isDecommissioned ( ) ? 1 : 0 ; numLiveExcluded += ns . inExcludedHostsList ( d , null ) ? 1 : 0 ; } int numDead = dead . size ( ) ; int numDeadExcluded = 0 ; int numDeadDecommissioningNotCompleted = 0 ; int numDeadDecommissioned = 0 ; for ( DatanodeDescriptor d : dead ) { numDeadDecommissioned += d . isDecommissioned ( ) ? 1 : 0 ; numDeadExcluded += ns . inExcludedHostsList ( d , null ) ? 1 : 0 ; } numDeadDecommissioningNotCompleted = numDeadExcluded - numDeadDecommissioned ; return new DatanodeStatus ( numLive , numLiveExcluded , numLiveDecommissioningInProgress , numLiveDecommissioned , numDead , numDeadExcluded , numDeadDecommissioningNotCompleted , numDeadDecommissioned ) ; }
Get status of the datanodes in the system.