Repository: hbase
Updated Branches:
  refs/heads/master 7cc239fb5 -> 24bed6b3f


 HBASE-19986 If HBaseTestClassRule timesout a test, thread dump; ADDENDUM; 
white-space, checkstyle, and rb feedback by Duo


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

Branch: refs/heads/master
Commit: 24bed6b3fbb54a20ef67201c160de649421cdd51
Parents: 7cc239f
Author: Michael Stack <st...@apache.org>
Authored: Mon Feb 12 18:12:08 2018 -0800
Committer: Michael Stack <st...@apache.org>
Committed: Mon Feb 12 18:12:24 2018 -0800

----------------------------------------------------------------------
 .../apache/hadoop/hbase/HBaseClassTestRule.java |  2 +-
 .../org/apache/hadoop/hbase/TestTimeout.java    |  9 +++-----
 .../hadoop/hbase/TimedOutTestsListener.java     | 22 ++++++++++----------
 3 files changed, 15 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/24bed6b3/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java
----------------------------------------------------------------------
diff --git 
a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java 
b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java
index b964872..d47b213 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java
@@ -1,4 +1,4 @@
-/*
+/**
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information

http://git-wip-us.apache.org/repos/asf/hbase/blob/24bed6b3/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTimeout.java
----------------------------------------------------------------------
diff --git 
a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTimeout.java 
b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTimeout.java
index 495667c..d547ddb 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTimeout.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestTimeout.java
@@ -33,7 +33,7 @@ public class TestTimeout {
 
     @Test
     public void run1() throws InterruptedException {
-        Thread.sleep(100);
+      Thread.sleep(100);
     }
 
     /**
@@ -46,14 +46,11 @@ public class TestTimeout {
       Thread t = new Thread("HangingThread") {
         public void run() {
           synchronized(this) {
-            while(true) {
-            }
+            while(true) {}
           }
         }
       };
       t.start();
-      while (true) {
-        // Just hang out too.
-      }
+      while (true) {}
    }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/24bed6b3/hbase-common/src/test/java/org/apache/hadoop/hbase/TimedOutTestsListener.java
----------------------------------------------------------------------
diff --git 
a/hbase-common/src/test/java/org/apache/hadoop/hbase/TimedOutTestsListener.java 
b/hbase-common/src/test/java/org/apache/hadoop/hbase/TimedOutTestsListener.java
index d5c87f3..643058c 100644
--- 
a/hbase-common/src/test/java/org/apache/hadoop/hbase/TimedOutTestsListener.java
+++ 
b/hbase-common/src/test/java/org/apache/hadoop/hbase/TimedOutTestsListener.java
@@ -40,15 +40,15 @@ import org.junit.runner.notification.RunListener;
 public class TimedOutTestsListener extends RunListener {
 
   static final String TEST_TIMED_OUT_PREFIX = "test timed out after";
-  
+
   private static String INDENT = "    ";
 
   private final PrintWriter output;
-  
+
   public TimedOutTestsListener() {
     this.output = new PrintWriter(System.err);
   }
-  
+
   public TimedOutTestsListener(PrintWriter output) {
     this.output = output;
   }
@@ -63,16 +63,16 @@ public class TimedOutTestsListener extends RunListener {
     }
     output.flush();
   }
-  
+
   public static String buildThreadDiagnosticString() {
     StringWriter sw = new StringWriter();
     PrintWriter output = new PrintWriter(sw);
-    
+
     DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss,SSS");
     output.println(String.format("Timestamp: %s", dateFormat.format(new 
Date())));
     output.println();
     output.println(buildThreadDump());
-    
+
     String deadlocksInfo = buildDeadlockInfo();
     if (deadlocksInfo != null) {
       output.println("====> DEADLOCKS DETECTED <====");
@@ -106,28 +106,28 @@ public class TimedOutTestsListener extends RunListener {
     }
     return dump.toString();
   }
-  
+
   static String buildDeadlockInfo() {
     ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
     long[] threadIds = threadBean.findMonitorDeadlockedThreads();
     if (threadIds != null && threadIds.length > 0) {
       StringWriter stringWriter = new StringWriter();
       PrintWriter out = new PrintWriter(stringWriter);
-      
+
       ThreadInfo[] infos = threadBean.getThreadInfo(threadIds, true, true);
       for (ThreadInfo ti : infos) {
         printThreadInfo(ti, out);
         printLockInfo(ti.getLockedSynchronizers(), out);
         out.println();
       }
-      
+
       out.close();
       return stringWriter.toString();
     } else {
       return null;
     }
   }
-  
+
   private static void printThreadInfo(ThreadInfo ti, PrintWriter out) {
     // print thread information
     printThread(ti, out);
@@ -173,5 +173,5 @@ public class TimedOutTestsListener extends RunListener {
     }
     out.println();
   }
-  
+
 }

Reply via email to