code: private static DatanodeInfo[] pickSrcDatanode(FileStatus i,
        ClientProtocol nnproxy) throws IOException {
      // a race condition can happen by initializing a static member this way.
      // A proper fix should make JspHelper a singleton. Since it doesn't affect 
      // correctness, we leave it as is for now.
      if (jspHelper == null)
        jspHelper = new JspHelper();
      final LocatedBlocks blks = nnproxy.getBlockLocations(
          i.getPath().toUri().getPath(), 0, 1);
      if (i.getLen() == 0 || blks.getLocatedBlocks().size() <= 0) {
        // pick a random datanode
        return new DatanodeInfo[] { jspHelper.randomNode() };
      }
      return jspHelper.bestNode(blks);
    }
docs: Select a datanode to service this request, which is the first one
  in the returned array. The rest of the elements in the datanode
  are possible candidates if the first one fails.
  Currently, this looks at no more than the first five blocks of a file,
  selecting a datanode randomly from the most represented.