Package org.apache.hadoop.dfs

Examples of org.apache.hadoop.dfs.DatanodeDescriptor$BlockTargetPair


      if (isRack()) { // children are leaves
        // range check
        if (leaveIndex<0 || leaveIndex>=this.getNumOfChildren()) {
          return null;
        }
        DatanodeDescriptor child =
          (DatanodeDescriptor)children.get(leaveIndex);
        if (excludedNode == null || excludedNode != child) {
          // child is not the excludedNode
          return child;
        } else { // child is the excludedNode so return the next child
          if (leaveIndex+1>=this.getNumOfChildren()) {
            return null;
          } else {
            return (DatanodeDescriptor)children.get(leaveIndex+1);
          }
        }
      } else {
        for(int i=0; i<children.size(); i++) {
          InnerNode child = (InnerNode)children.get(i);
          if (excludedNode == null || excludedNode != child) {
            // not the excludedNode
            int numOfLeaves = child.getNumOfLeaves();
            if (excludedNode != null && child.isAncestor(excludedNode)) {
              numOfLeaves -= numOfExcludedLeaves;
            }
            if (count+numOfLeaves > leaveIndex) {
              // the leaf is in the child subtree
              return child.getLeaf(leaveIndex-count, excludedNode);
            } else {
              // go to the next child
              count = count+numOfLeaves;
            }
          } else { // it is the excluededNode
View Full Code Here


            if( isRack() ) { // children are leaves
                // range check
                if(leaveIndex<0 || leaveIndex>=this.getNumOfChildren()) {
                    return null;
                }
                DatanodeDescriptor child =
                    (DatanodeDescriptor)children.get(leaveIndex);
                if(excludedNode == null || excludedNode != child) {
                    // child is not the excludedNode
                    return child;
                } else { // child is the excludedNode so return the next child
                    if(leaveIndex+1>=this.getNumOfChildren()) {
                        return null;
                    } else {
                        return (DatanodeDescriptor)children.get(leaveIndex+1);
                    }
                }
            } else {
                for( int i=0; i<children.size(); i++ ) {
                    InnerNode child = (InnerNode)children.get(i);
                    if(excludedNode == null || excludedNode != child) {
                        // not the excludedNode
                        int numOfLeaves = child.getNumOfLeaves();
                        if( excludedNode != null && child.isAncestor(excludedNode) ) {
                            numOfLeaves -= numOfExcludedLeaves;
                        }
                        if( count+numOfLeaves > leaveIndex ) {
                            // the leaf is in the child subtree
                            return child.getLeaf(leaveIndex-count, excludedNode);
                        } else {
                            // go to the next child
                            count = count+numOfLeaves;
                        }
                    } else { // it is the excluededNode
View Full Code Here

    return tree.toString();
  }

  /* swap two array items */
  static private void swap(DatanodeDescriptor[] nodes, int i, int j) {
    DatanodeDescriptor tempNode;
    tempNode = nodes[j];
    nodes[j] = nodes[i];
    nodes[i] = tempNode;
   
  }
View Full Code Here

      if (isRack()) { // children are leaves
        // range check
        if (leaveIndex<0 || leaveIndex>=this.getNumOfChildren()) {
          return null;
        }
        DatanodeDescriptor child =
          (DatanodeDescriptor)children.get(leaveIndex);
        if (excludedNode == null || excludedNode != child) {
          // child is not the excludedNode
          return child;
        } else { // child is the excludedNode so return the next child
          if (leaveIndex+1>=this.getNumOfChildren()) {
            return null;
          } else {
            return (DatanodeDescriptor)children.get(leaveIndex+1);
          }
        }
      } else {
        for(int i=0; i<children.size(); i++) {
          InnerNode child = (InnerNode)children.get(i);
          if (excludedNode == null || excludedNode != child) {
            // not the excludedNode
            int numOfLeaves = child.getNumOfLeaves();
            if (excludedNode != null && child.isAncestor(excludedNode)) {
              numOfLeaves -= numOfExcludedLeaves;
            }
            if (count+numOfLeaves > leaveIndex) {
              // the leaf is in the child subtree
              return child.getLeaf(leaveIndex-count, excludedNode);
            } else {
              // go to the next child
              count = count+numOfLeaves;
            }
          } else { // it is the excluededNode
View Full Code Here

            if( isRack() ) { // children are leaves
                // range check
                if(leaveIndex<0 || leaveIndex>=this.getNumOfChildren()) {
                    return null;
                }
                DatanodeDescriptor child =
                    (DatanodeDescriptor)children.get(leaveIndex);
                if(excludedNode == null || excludedNode != child) {
                    // child is not the excludedNode
                    return child;
                } else { // child is the excludedNode so return the next child
                    if(leaveIndex+1>=this.getNumOfChildren()) {
                        return null;
                    } else {
                        return (DatanodeDescriptor)children.get(leaveIndex+1);
                    }
                }
            } else {
                for( int i=0; i<children.size(); i++ ) {
                    InnerNode child = (InnerNode)children.get(i);
                    if(excludedNode == null || excludedNode != child) {
                        // not the excludedNode
                        int numOfLeaves = child.getNumOfLeaves();
                        if( excludedNode != null && child.isAncestor(excludedNode) ) {
                            numOfLeaves -= numOfExcludedLeaves;
                        }
                        if( count+numOfLeaves > leaveIndex ) {
                            // the leaf is in the child subtree
                            return child.getLeaf(leaveIndex-count, excludedNode);
                        } else {
                            // go to the next child
                            count = count+numOfLeaves;
                        }
                    } else { // it is the excluededNode
View Full Code Here

TOP

Related Classes of org.apache.hadoop.dfs.DatanodeDescriptor$BlockTargetPair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.