You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "stack (Commented) (JIRA)" <ji...@apache.org> on 2011/10/20 20:50:11 UTC
[jira] [Commented] (HBASE-4613)
hbase.util.Threads#threadDumpingIsAlive sleeps 1 second, slowing down the
shutdown by 0.5s
[ https://issues.apache.org/jira/browse/HBASE-4613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13131897#comment-13131897 ]
stack commented on HBASE-4613:
------------------------------
I changed that because we had hanging tests. This helps in that you get a bit of clue as to why the test won't go down. What you want to do Nicolas? Change the wait so we don't sleep so long?
> 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