Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.94.0
-
None
-
None
-
all
-
Reviewed
Description
Current implementation is:
/** * @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()); } } }
while this one would make more sense considering the documentation, and save around 0,5s when the MiniCluster shutdowns.
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()); } } }
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...
Attachments
Attachments
Issue Links
- is required by
-
HBASE-4602 Make the suite run in at least half the time
- Closed