Revert "Fix the flaky TestThriftHttpServer"

This reverts commit 4f7aa3b71d.
This commit is contained in:
huzheng 2018-05-09 10:44:35 +08:00
parent 4f7aa3b71d
commit dda8018b0f
1 changed files with 18 additions and 9 deletions

View File

@ -57,6 +57,7 @@ import org.apache.hbase.thirdparty.com.google.common.base.Joiner;
* interface and talk to it from client side. * interface and talk to it from client side.
*/ */
@Category({ClientTests.class, LargeTests.class}) @Category({ClientTests.class, LargeTests.class})
public class TestThriftHttpServer { public class TestThriftHttpServer {
@ClassRule @ClassRule
@ -117,14 +118,18 @@ public class TestThriftHttpServer {
LOG.info("Starting HBase Thrift server with HTTP server: " + Joiner.on(" ").join(args)); LOG.info("Starting HBase Thrift server with HTTP server: " + Joiner.on(" ").join(args));
httpServerException = null; httpServerException = null;
httpServerThread = new Thread(() -> { httpServerThread = new Thread(new Runnable() {
@Override
public void run() {
try { try {
thriftServer.doMain(args); thriftServer.doMain(args);
} catch (Exception e) { } catch (Exception e) {
httpServerException = e; httpServerException = e;
} }
}
}); });
httpServerThread.setName(ThriftServer.class.getSimpleName() + "-httpServer"); httpServerThread.setName(ThriftServer.class.getSimpleName() +
"-httpServer");
httpServerThread.start(); httpServerThread.start();
} }
@ -163,7 +168,11 @@ public class TestThriftHttpServer {
startHttpServerThread(args.toArray(new String[args.size()])); startHttpServerThread(args.toArray(new String[args.size()]));
// wait up to 10s for the server to start // wait up to 10s for the server to start
HBaseTestingUtility.waitForHostPort(HConstants.LOCALHOST, port); for (int i = 0; i < 100
&& (thriftServer.serverRunner == null || thriftServer.serverRunner.httpServer ==
null); i++) {
Thread.sleep(100);
}
String url = "http://"+ HConstants.LOCALHOST + ":" + port; String url = "http://"+ HConstants.LOCALHOST + ":" + port;
try { try {