MAPREDUCE-6804. Add timeout when starting JobHistoryServer in MiniMRYarnCluster. Contributed by Andras Bokor

This commit is contained in:
Jason Lowe 2016-11-16 15:23:12 +00:00
parent d65603517e
commit 7ef290cfef

View File

@ -45,6 +45,7 @@
import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.service.AbstractService; import org.apache.hadoop.service.AbstractService;
import org.apache.hadoop.service.Service; import org.apache.hadoop.service.Service;
import org.apache.hadoop.test.GenericTestUtils;
import org.apache.hadoop.util.JarFinder; import org.apache.hadoop.util.JarFinder;
import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
@ -255,11 +256,8 @@ public void run() {
}; };
}.start(); }.start();
while (!jhsStarted) { GenericTestUtils.waitFor(() -> jhsStarted, 1500, 60_000);
LOG.info("Waiting for HistoryServer to start...");
Thread.sleep(1500);
}
//TODO Add a timeout. State.STOPPED check ?
if (historyServer.getServiceState() != STATE.STARTED) { if (historyServer.getServiceState() != STATE.STARTED) {
throw new IOException("HistoryServer failed to start"); throw new IOException("HistoryServer failed to start");
} }