diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java index 630b7ef..1e1e7f3 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-tests/src/test/java/org/apache/hadoop/yarn/server/MiniYARNCluster.java @@ -314,19 +314,7 @@ public void handle(RMAppAttemptEvent event) { private synchronized void startResourceManager(final int index) { try { - Thread rmThread = new Thread() { - public void run() { - resourceManagers[index].start(); - } - }; - rmThread.setName("RM-" + index); - rmThread.start(); - int waitCount = 0; - while (resourceManagers[index].getServiceState() == STATE.INITED - && waitCount++ < 60) { - LOG.info("Waiting for RM to start..."); - Thread.sleep(1500); - } + resourceManagers[index].start(); if (resourceManagers[index].getServiceState() != STATE.STARTED) { // RM could have failed. throw new IOException( @@ -565,26 +553,12 @@ private String prepareDirs(String dirType, int numDirs) { } protected synchronized void serviceStart() throws Exception { - try { - new Thread() { - public void run() { - nodeManagers[index].start(); - } - }.start(); - int waitCount = 0; - while (nodeManagers[index].getServiceState() == STATE.INITED - && waitCount++ < 60) { - LOG.info("Waiting for NM " + index + " to start..."); - Thread.sleep(1000); - } - if (nodeManagers[index].getServiceState() != STATE.STARTED) { - // RM could have failed. - throw new IOException("NodeManager " + index + " failed to start"); - } - super.serviceStart(); - } catch (Throwable t) { - throw new YarnRuntimeException(t); + nodeManagers[index].start(); + if (nodeManagers[index].getServiceState() != STATE.STARTED) { + // RM could have failed. + throw new IOException("NodeManager " + index + " failed to start"); } + super.serviceStart(); } @Override @@ -765,18 +739,7 @@ protected synchronized void serviceInit(Configuration conf) @Override protected synchronized void serviceStart() throws Exception { - - new Thread() { - public void run() { - appHistoryServer.start(); - }; - }.start(); - int waitCount = 0; - while (appHistoryServer.getServiceState() == STATE.INITED - && waitCount++ < 60) { - LOG.info("Waiting for Timeline Server to start..."); - Thread.sleep(1500); - } + appHistoryServer.start(); if (appHistoryServer.getServiceState() != STATE.STARTED) { // AHS could have failed. IOException ioe = new IOException(