hbase git commit: HBASE-20543 Fix the flaky TestThriftHttpServer

2018-05-08 Thread openinx
Repository: hbase
Updated Branches:
  refs/heads/branch-2 75a8e53ce -> 8d60a89c3


HBASE-20543 Fix the flaky TestThriftHttpServer


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/8d60a89c
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/8d60a89c
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/8d60a89c

Branch: refs/heads/branch-2
Commit: 8d60a89c348f9428dabb3ff924c4b2f22a127562
Parents: 75a8e53
Author: huzheng 
Authored: Wed May 9 09:56:34 2018 +0800
Committer: huzheng 
Committed: Wed May 9 10:41:08 2018 +0800

--
 .../hbase/thrift/TestThriftHttpServer.java  | 27 +++-
 1 file changed, 9 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/8d60a89c/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
--
diff --git 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
index c3fecf6..2366ee7 100644
--- 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
+++ 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
@@ -57,7 +57,6 @@ import 
org.apache.hbase.thirdparty.com.google.common.base.Joiner;
  * interface and talk to it from client side.
  */
 @Category({ClientTests.class, LargeTests.class})
-
 public class TestThriftHttpServer {
 
   @ClassRule
@@ -118,18 +117,14 @@ public class TestThriftHttpServer {
 LOG.info("Starting HBase Thrift server with HTTP server: " + Joiner.on(" 
").join(args));
 
 httpServerException = null;
-httpServerThread = new Thread(new Runnable() {
-  @Override
-  public void run() {
-try {
-  thriftServer.doMain(args);
-} catch (Exception e) {
-  httpServerException = e;
-}
+httpServerThread = new Thread(() -> {
+  try {
+thriftServer.doMain(args);
+  } catch (Exception e) {
+httpServerException = e;
   }
 });
-httpServerThread.setName(ThriftServer.class.getSimpleName() +
-"-httpServer");
+httpServerThread.setName(ThriftServer.class.getSimpleName() + 
"-httpServer");
 httpServerThread.start();
   }
 
@@ -168,13 +163,9 @@ public class TestThriftHttpServer {
 startHttpServerThread(args.toArray(new String[args.size()]));
 
 // wait up to 10s for the server to start
-for (int i = 0; i < 100
-&& ( thriftServer.serverRunner == null ||  
thriftServer.serverRunner.httpServer ==
-null); i++) {
-  Thread.sleep(100);
-}
+HBaseTestingUtility.waitForHostPort(HConstants.LOCALHOST, port);
 
-String url = "http://"+ HConstants.LOCALHOST + ":" + port;
+String url = "http://"; + HConstants.LOCALHOST + ":" + port;
 try {
   checkHttpMethods(url);
   talkToThriftServer(url, customHeaderSize);
@@ -186,7 +177,7 @@ public class TestThriftHttpServer {
 
 if (clientSideException != null) {
   LOG.error("Thrift client threw an exception " + clientSideException);
-  if (clientSideException instanceof  TTransportException) {
+  if (clientSideException instanceof TTransportException) {
 throw clientSideException;
   } else {
 throw new Exception(clientSideException);



[2/2] hbase git commit: HBASE-20543 Fix the flaky TestThriftHttpServer

2018-05-08 Thread openinx
HBASE-20543 Fix the flaky TestThriftHttpServer


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/0dcae90e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0dcae90e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0dcae90e

Branch: refs/heads/master
Commit: 0dcae90eaab985180ac145fa04077360aa03b8c7
Parents: dda8018
Author: huzheng 
Authored: Wed May 9 10:50:09 2018 +0800
Committer: huzheng 
Committed: Wed May 9 10:50:09 2018 +0800

--
 .../hbase/thrift/TestThriftHttpServer.java  | 27 +++-
 1 file changed, 9 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/0dcae90e/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
--
diff --git 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
index 6117953..2366ee7 100644
--- 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
+++ 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
@@ -57,7 +57,6 @@ import 
org.apache.hbase.thirdparty.com.google.common.base.Joiner;
  * interface and talk to it from client side.
  */
 @Category({ClientTests.class, LargeTests.class})
-
 public class TestThriftHttpServer {
 
   @ClassRule
@@ -118,18 +117,14 @@ public class TestThriftHttpServer {
 LOG.info("Starting HBase Thrift server with HTTP server: " + Joiner.on(" 
").join(args));
 
 httpServerException = null;
-httpServerThread = new Thread(new Runnable() {
-  @Override
-  public void run() {
-try {
-  thriftServer.doMain(args);
-} catch (Exception e) {
-  httpServerException = e;
-}
+httpServerThread = new Thread(() -> {
+  try {
+thriftServer.doMain(args);
+  } catch (Exception e) {
+httpServerException = e;
   }
 });
-httpServerThread.setName(ThriftServer.class.getSimpleName() +
-"-httpServer");
+httpServerThread.setName(ThriftServer.class.getSimpleName() + 
"-httpServer");
 httpServerThread.start();
   }
 
@@ -168,13 +163,9 @@ public class TestThriftHttpServer {
 startHttpServerThread(args.toArray(new String[args.size()]));
 
 // wait up to 10s for the server to start
-for (int i = 0; i < 100
-&& (thriftServer.serverRunner == null ||  
thriftServer.serverRunner.httpServer ==
-null); i++) {
-  Thread.sleep(100);
-}
+HBaseTestingUtility.waitForHostPort(HConstants.LOCALHOST, port);
 
-String url = "http://"+ HConstants.LOCALHOST + ":" + port;
+String url = "http://"; + HConstants.LOCALHOST + ":" + port;
 try {
   checkHttpMethods(url);
   talkToThriftServer(url, customHeaderSize);
@@ -186,7 +177,7 @@ public class TestThriftHttpServer {
 
 if (clientSideException != null) {
   LOG.error("Thrift client threw an exception " + clientSideException);
-  if (clientSideException instanceof  TTransportException) {
+  if (clientSideException instanceof TTransportException) {
 throw clientSideException;
   } else {
 throw new Exception(clientSideException);



[05/34] hbase git commit: HBASE-20543 Fix the flaky TestThriftHttpServer

2018-05-09 Thread zhangduo
HBASE-20543 Fix the flaky TestThriftHttpServer


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/0dcae90e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/0dcae90e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/0dcae90e

Branch: refs/heads/HBASE-19064
Commit: 0dcae90eaab985180ac145fa04077360aa03b8c7
Parents: dda8018
Author: huzheng 
Authored: Wed May 9 10:50:09 2018 +0800
Committer: huzheng 
Committed: Wed May 9 10:50:09 2018 +0800

--
 .../hbase/thrift/TestThriftHttpServer.java  | 27 +++-
 1 file changed, 9 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hbase/blob/0dcae90e/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
--
diff --git 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
index 6117953..2366ee7 100644
--- 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
+++ 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServer.java
@@ -57,7 +57,6 @@ import 
org.apache.hbase.thirdparty.com.google.common.base.Joiner;
  * interface and talk to it from client side.
  */
 @Category({ClientTests.class, LargeTests.class})
-
 public class TestThriftHttpServer {
 
   @ClassRule
@@ -118,18 +117,14 @@ public class TestThriftHttpServer {
 LOG.info("Starting HBase Thrift server with HTTP server: " + Joiner.on(" 
").join(args));
 
 httpServerException = null;
-httpServerThread = new Thread(new Runnable() {
-  @Override
-  public void run() {
-try {
-  thriftServer.doMain(args);
-} catch (Exception e) {
-  httpServerException = e;
-}
+httpServerThread = new Thread(() -> {
+  try {
+thriftServer.doMain(args);
+  } catch (Exception e) {
+httpServerException = e;
   }
 });
-httpServerThread.setName(ThriftServer.class.getSimpleName() +
-"-httpServer");
+httpServerThread.setName(ThriftServer.class.getSimpleName() + 
"-httpServer");
 httpServerThread.start();
   }
 
@@ -168,13 +163,9 @@ public class TestThriftHttpServer {
 startHttpServerThread(args.toArray(new String[args.size()]));
 
 // wait up to 10s for the server to start
-for (int i = 0; i < 100
-&& (thriftServer.serverRunner == null ||  
thriftServer.serverRunner.httpServer ==
-null); i++) {
-  Thread.sleep(100);
-}
+HBaseTestingUtility.waitForHostPort(HConstants.LOCALHOST, port);
 
-String url = "http://"+ HConstants.LOCALHOST + ":" + port;
+String url = "http://"; + HConstants.LOCALHOST + ":" + port;
 try {
   checkHttpMethods(url);
   talkToThriftServer(url, customHeaderSize);
@@ -186,7 +177,7 @@ public class TestThriftHttpServer {
 
 if (clientSideException != null) {
   LOG.error("Thrift client threw an exception " + clientSideException);
-  if (clientSideException instanceof  TTransportException) {
+  if (clientSideException instanceof TTransportException) {
 throw clientSideException;
   } else {
 throw new Exception(clientSideException);