MAPREDUCE-6804. Add timeout when starting JobHistoryServer in MiniMRYarnCluster. Contributed by Andras Bokor
(cherry picked from commit 41f8275c50
)
This commit is contained in:
parent
cf366a0fd6
commit
e27fbcb50c
|
@ -24,6 +24,7 @@ import java.net.InetAddress;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.classification.InterfaceAudience;
|
import org.apache.hadoop.classification.InterfaceAudience;
|
||||||
|
@ -45,6 +46,7 @@ import org.apache.hadoop.mapreduce.v2.util.MRWebAppUtil;
|
||||||
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;
|
||||||
|
@ -216,11 +218,13 @@ public class MiniMRYarnCluster extends MiniYARNCluster {
|
||||||
};
|
};
|
||||||
}.start();
|
}.start();
|
||||||
|
|
||||||
while (!jhsStarted) {
|
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
||||||
LOG.info("Waiting for HistoryServer to start...");
|
@Override
|
||||||
Thread.sleep(1500);
|
public Boolean get() {
|
||||||
|
return jhsStarted;
|
||||||
}
|
}
|
||||||
//TODO Add a timeout. State.STOPPED check ?
|
}, 1500, 60_000);
|
||||||
|
|
||||||
if (historyServer.getServiceState() != STATE.STARTED) {
|
if (historyServer.getServiceState() != STATE.STARTED) {
|
||||||
throw new IOException("HistoryServer failed to start");
|
throw new IOException("HistoryServer failed to start");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue