code: private final void reconnectToNewJobTracker(int connectNum) throws IOException {
      if (connectNum >= CONNECT_MAX_NUMBER) {
        LOG.error("reconnectToNewJobTracker has reached its max number.");
        throw new IOException("reconnectToNewJobTracker has reached its max number.");
      }
      
      InetSocketAddress secondaryTracker = getSecondaryTracker();
      JobConf conf = getConf();
      InetSocketAddress oldAddress = getCurrentClientAddress();
  
      LOG.info("Falling back from " + oldAddress + " to secondary tracker at "
          + secondaryTracker + " with " + connectNum + " try");
      if (secondaryTracker == null)
        throw new IOException("Secondary address not provided.");
  
      shutdown();
      InterCoronaJobTrackerProtocol secondaryClient = RPC.waitForProxy(
          InterCoronaJobTrackerProtocol.class,
          InterCoronaJobTrackerProtocol.versionID, secondaryTracker, conf,
          SECONDARY_TRACKER_CONNECT_TIMEOUT);
      // Obtain new address
      InetSocketAddressWritable oldAddrWritable = new InetSocketAddressWritable(
          oldAddress);
      InetSocketAddressWritable newAddress = null;
      int retryNum = 0;
      do {
        newAddress = secondaryClient.getNewJobTrackerAddress(oldAddrWritable);
        try {
          waitRetry();
        } catch (InterruptedException e) {
          LOG.error("Fallback interrupted, taking next retry.");
        }
        ++retryNum;
      } while (newAddress == null && predRetry(retryNum));
  
      if (newAddress == null || newAddress.getAddress() == null)
        throw new IOException("Failed to obtain new job tracker address.");
  
      RPC.stopProxy(secondaryClient);
      try {
        connect(newAddress.getAddress());
        LOG.info("Fallback process successful: " + newAddress.getAddress());
      } catch (IOException e) {
        LOG.error("Fallback connect to " + newAddress.getAddress() + " failed for ", e);
        reconnectToNewJobTracker(++connectNum);
      }
    }
docs: Reconnects to new address obtained from secondary address via
  InterCoronaTrackerProtocol
  @throws IOException