[
https://issues.apache.org/jira/browse/HBASE-4613?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
stack resolved HBASE-4613.
--------------------------
Resolution: Fixed
Fix Version/s: 0.92.0
Hadoop Flags: Reviewed
Committed trunk and 0.92 branch. Thanks for the patch N.
> 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
> Fix For: 0.92.0
>
> Attachments: 20111020_4613_Threads.patch
>
>
> 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