code: private boolean needLocalityCheck(
        LocalityLevel level, long nodeWait, long rackWait) {
      if (level == LocalityLevel.NODE) {
        return nodeWait != 0;
      }
      if (level == LocalityLevel.RACK) {
        return rackWait != 0;
      }
      return false;
    }
docs: If the locality wait time is zero, we don't need to check locality at all.
  @param level The level
  @param nodeWait The amount of time in msec to wait for node locality
  @param rackWait The amount of time in msec to wait for rack locality
  @return True if the locality check is needed, false otherwise.