code: protected void chooseFirstInRemoteRack(DatanodeDescriptor localMachine,
        HashMap<Node, Node> excludedNodes, long blocksize,
        int maxReplicasPerRack, List<DatanodeDescriptor> results)
        throws NotEnoughReplicasException {
      readLock();
      try {
        RackRingInfo rackInfo = racksMap.get(localMachine.getNetworkLocation());
        assert (rackInfo != null);
  
        Integer machineId = rackInfo.findNode(localMachine);
        assert (machineId != null);
  
        if (!chooseRemoteRack(rackInfo.index, rackInfo.index, rackWindow + 1,
            machineId, machineWindow, excludedNodes, blocksize,
            maxReplicasPerRack, results, false)) {
          LOG.info("Couldn't find a Datanode within node group. "
              + "Resorting to default policy.");
          super.chooseRemoteRack(1, localMachine, excludedNodes, blocksize,
              maxReplicasPerRack, results);
        }
      } finally {
        readUnlock();
      }
    }
docs: Picks up the first replica stored in a remote rack.
  @param localMachine local machine that is writing the data
  @param excludedNodes nodes that should not be considered
  @param blocksize size of blocks
  @param maxReplicasPerRack maximum replicas per rack
  @param results datanodes used for replicas
  @throws NotEnoughReplicasException