code: private DatanodeDescriptor[] chooseTarget(ReplicationWork work) {
      if (!neededReplications.contains(work.block)) {
        return null;
      }
      if (work.blockSize == BlockFlags.NO_ACK) {
        LOG.warn("Block " + work.block.getBlockId() + 
            " of the file " + getFullPathName(work.fileINode) + 
            " is invalidated and cannot be replicated.");
        return null;
      }
      if (work.blockSize == BlockFlags.DELETED) {
        LOG.warn("Block " + work.block.getBlockId() + 
            " of the file " + getFullPathName(work.fileINode) + 
            " is a deleted block and cannot be replicated.");
        return null;
      }
      return replicator.chooseTarget(work.fileINode,
          work.numOfReplicas, work.srcNode,
          work.containingNodes, null, work.blockSize);
    }
docs: Wrapper function for choosing targets for replication.