org.apache.hadoop.hbase.util
Class Threads

java.lang.Object
  extended by org.apache.hadoop.hbase.util.Threads

public class Threads
extends Object

Thread Utility


Field Summary
protected static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
Threads()
           
 
Method Summary
static Thread setDaemonThreadRunning(Thread t)
          Utility method that sets name, daemon status and starts passed thread.
static Thread setDaemonThreadRunning(Thread t, String name)
          Utility method that sets name, daemon status and starts passed thread.
static Thread setDaemonThreadRunning(Thread t, String name, Thread.UncaughtExceptionHandler handler)
          Utility method that sets name, daemon status and starts passed thread.
static void shutdown(Thread t)
          Shutdown passed thread using isAlive and join.
static void shutdown(Thread t, long joinwait)
          Shutdown passed thread using isAlive and join.
static void sleep(int millis)
           
static void threadDumpingIsAlive(Thread t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Constructor Detail

Threads

public Threads()
Method Detail

setDaemonThreadRunning

public static Thread setDaemonThreadRunning(Thread t)
Utility method that sets name, daemon status and starts passed thread.

Parameters:
t - thread to run
Returns:
Returns the passed Thread t.

setDaemonThreadRunning

public static Thread setDaemonThreadRunning(Thread t,
                                            String name)
Utility method that sets name, daemon status and starts passed thread.

Parameters:
t - thread to frob
name - new name
Returns:
Returns the passed Thread t.

setDaemonThreadRunning

public static Thread setDaemonThreadRunning(Thread t,
                                            String name,
                                            Thread.UncaughtExceptionHandler handler)
Utility method that sets name, daemon status and starts passed thread.

Parameters:
t - thread to frob
name - new name
handler - A handler to set on the thread. Pass null if want to use default handler.
Returns:
Returns the passed Thread t.

shutdown

public static void shutdown(Thread t)
Shutdown passed thread using isAlive and join.

Parameters:
t - Thread to shutdown

shutdown

public static void shutdown(Thread t,
                            long joinwait)
Shutdown passed thread using isAlive and join.

Parameters:
joinwait - Pass 0 if we're to wait forever.
t - Thread to shutdown

threadDumpingIsAlive

public static void threadDumpingIsAlive(Thread t)
                                 throws InterruptedException
Parameters:
t - Waits on the passed thread to die dumping a threaddump every minute while its up.
Throws:
InterruptedException

sleep

public static void sleep(int millis)
Parameters:
millis - How long to sleep for in milliseconds.


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.