/**
* Restarts remote JT if there was running job and resubmits this job.
* @throws IOException
*/
private void restartRemoteJTUnprotected() throws IOException {
SessionDriver sessionDriver = jt.getSessionDriver();
if (remoteSessionId != null) {
// Kill remote session - new JT will acquire new session
sessionDriver.stopRemoteSession(remoteSessionId);
}
if (!isStateRestoringEnabled(conf)) {
// Change attempt id only if we're not restoring state
attemptJobId = prepareNextAttempt(attemptJobId);
} else {
// notify the remote job tracker the number of
// remote job tracker get restarted
remoteJTState.restartNum = numRemoteJTFailures;
}
// Stop RPC client.
RPC.stopProxy(client);
client = null;
// Increment attempt to kill old JT on next connection attempt.
incrementAttemptUnprotected();
if (sessionDriver != null) {
sessionDriver.setName("Launch pending for " + conf.getJobName());
}
// Restart remote JT, don't release client lock yet.
waitForJTStart(conf);
// Resubmit job directly.
try {
if (isJobSubmitted) {
LOG.warn("Resubmitting job " + jobId.toString());
client.submitJob(attemptJobId);
}
// Set our info server url in parent JT and CM.
String url = getJobProfile(attemptJobId).getURL().toString();
jt.setRemoteJTUrl(url);
if (sessionDriver != null) {
sessionDriver.setName("Launched session " + getRemoteSessionId());
}
// If reached this point assume success.
LOG.warn("Successfully restarted remote JT.");
if (remoteJTState != null) {
if (LOG.isInfoEnabled()) {