code: public void run() {
      try {
        startCleanupThreads();
        try {
          // This while-loop attempts reconnects if we get network errors
          while (running && !shuttingDown) {
            try {
              State osState = offerService();
              if (osState == State.STALE || osState == State.DENIED) {
                // Shutdown TaskTracker instead of reinitialize.
                // TaskTracker should be restarted by external tools.
                LOG.error("offerService returns " + osState + ". Shutdown. ");
                break;
              }
            } catch (Exception ex) {
              if (!shuttingDown) {
                LOG.info("Lost connection to JobTracker [" +
                    jobTrackAddr + "].  Retrying...", ex);
                try {
                  Thread.sleep(5000);
                } catch (InterruptedException ie) {
                }
              }
            }
          }
        } finally {
          shutdown();
        }
      } catch (IOException iex) {
        LOG.error("Got fatal exception while initializing TaskTracker", iex);
        return;
      }
    }
docs: The server retry loop.
  This while-loop attempts to connect to the JobTracker.