You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "David Mollitor (Jira)" <ji...@apache.org> on 2019/12/11 17:29:00 UTC

[jira] [Created] (HBASE-23563) Deprecate Threads shutdown Methods

David Mollitor created HBASE-23563:
--------------------------------------

             Summary: Deprecate Threads shutdown Methods
                 Key: HBASE-23563
                 URL: https://issues.apache.org/jira/browse/HBASE-23563
             Project: HBase
          Issue Type: Improvement
            Reporter: David Mollitor


{code:java|title=Threads.java}
   /**
   * Shutdown passed thread using isAlive and join.
   * @param t Thread to shutdown
   */
  public static void shutdown(final Thread t) {
    shutdown(t, 0);
  }

  /**
   * Shutdown passed thread using isAlive and join.
   * @param joinwait Pass 0 if we're to wait forever.
   * @param t Thread to shutdown
   */
  public static void shutdown(final Thread t, final long joinwait) {
    if (t == null) return;
    while (t.isAlive()) {
      try {
        t.join(joinwait);
      } catch (InterruptedException e) {
        LOG.warn(t.getName() + "; joinwait=" + joinwait, e);
      }
    }
  }
{code}

# This method does not actually 'shutdown' anything, it just waits for thread to die uninterruptedly
# The InterruptedException is lost here

Please deprecated in favor of Guava's {{Uninterruptibles#joinUninterruptibly}}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)