hbase.util.Threads#threadDumpingIsAlive sleeps 1 second, slowing down the shutdown by 0.5s ------------------------------------------------------------------------------------------
Key: HBASE-4613 URL: https://issues.apache.org/jira/browse/HBASE-4613 Project: HBase Issue Type: Improvement Affects Versions: 0.94.0 Environment: all Reporter: nkeywal Assignee: nkeywal Priority: Minor Current implementation is: {noformat} /** * @param t Waits on the passed thread to die dumping a threaddump every * minute while its up. * @throws InterruptedException */ public static void threadDumpingIsAlive(final Thread t) throws InterruptedException { if (t == null) { return; } long startTime = System.currentTimeMillis(); while (t.isAlive()) { Thread.sleep(1000); if (System.currentTimeMillis() - startTime > 60000) { startTime = System.currentTimeMillis(); ReflectionUtils.printThreadInfo(new PrintWriter(System.out), "Automatic Stack Trace every 60 seconds waiting on " + t.getName()); } } } {noformat} while this one would make more sense considering the documentation, and save around 0,5s when the MiniCluster shutdowns. {noformat} public static void threadDumpingIsAlive(final Thread t) throws InterruptedException { if (t == null) { return; } while (t.isAlive()) { t.join(60 * 1000); if (t.isAlive()) { ReflectionUtils.printThreadInfo(new PrintWriter(System.out), "Automatic Stack Trace every 60 seconds waiting on " + t.getName()); } } } {noformat} However, it was replacing a previous implementation with a join without a timeout. So if anyone has a warning here... Tests seems to be ok... -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira