# Class: com.pnfsoftware.jeb.util.concurrent.ThreadUtil

Utility methods to manipulate threads.

## Constructor: ThreadUtil


## Static Method: create
- parameter: `r`, type: `java.lang.Runnable`
- return type: `java.lang.Thread`

Description: Create a daemon thread. **The thread is not started.**
parameter: r: non\-null runnable
return: the new thread

## Static Method: create
- parameter: `name`, type: `java.lang.String`
- parameter: `r`, type: `java.lang.Runnable`
- return type: `java.lang.Thread`

Description: Create a daemon thread. **The thread is not started.**
parameter: name: thread name
parameter: r: non\-null runnable
return: the new thread

## Static Method: formatStackTrace
- return type: `java.lang.String`

Description: Convenience method to generate the simplified stack trace of the caller, on a single line.
return: the formatted stack trace

## Static Method: formatStackTrace
- parameter: `skipcnt`, type: `int`
- return type: `java.lang.String`

Description: Convenience method to generate the simplified stack trace of the caller, on a single line.
parameter: skipcnt: how many top\-level callers should be removed
return: the formatted stack trace

## Static Method: formatStackTrace
- parameter: `skipcnt`, type: `int`
- parameter: `separator`, type: `java.lang.String`
- parameter: `displayClassPackageName`, type: `boolean`
- parameter: `displayLineNumber`, type: `boolean`
- return type: `java.lang.String`

Description: Convenience method to generate the simplified stack trace of the caller.
parameter: skipcnt: how many top\-level callers should be removed
parameter: separator: optional separator, use null for default \(`" < "`\)
parameter: displayClassPackageName: 
parameter: displayLineNumber: 
return: the formatted stack trace

## Static Method: interruptAndJoinUninterruptibly
- parameter: `thread`, type: `java.lang.Thread`

Description: Interrupt the target thread and wait for it to terminate, uninterruptibly.
parameter: thread: target Thread

## Static Method: joinU
- parameter: `thread`, type: `java.lang.Thread`

Description: Join a thread uninterruptibly. 

 Note: after successfully joining, if an [InterruptedException](InterruptedException) had arisen, the `interrupt` flag is re\-armed.
parameter: thread: the thread to join on

## Static Method: monitor
- parameter: `t`, type: `java.lang.Thread`
- parameter: `provider`, type: `com.pnfsoftware.jeb.util.concurrent.IMonitorInfoProvider`
- return type: `boolean`

Description: Monitor a running thread, and attempt to terminate it after a dynamic timeout has elapsed. **This method is blocking.** In order for this method to work properly and responsively, the monitored thread should check for [interruptions](Thread#isInterrupted()) regularly, and should not disregard [InterruptedException](InterruptedException)s.
parameter: t: the running thread
parameter: provider: information for the monitor \(timeout, probingPeriod, etc.\); if the probing            period is invalid, it will be set to a default 100ms.
return: true if the thread has ended successfully \(may have ended because it completed, may         have ended because it processed the interruption\); unless something bad happens \(eg,         the monitor is interrupted\), this method should always return true

## Static Method: start
- parameter: `r`, type: `java.lang.Runnable`
- return type: `java.lang.Thread`

Description: Create and start a new daemon thread.
parameter: r: non\-null runnable
return: the running thread

## Static Method: start
- parameter: `name`, type: `java.lang.String`
- parameter: `r`, type: `java.lang.Runnable`
- return type: `java.lang.Thread`

Description: Create and start a new daemon thread.
parameter: name: thread name
parameter: r: non\-null runnable
return: the running thread

## Static Method: stop
- parameter: `t`, type: `java.lang.Thread`
- return type: `boolean`

Description: Gracefully stop a running thread. **This method is blocking.**
parameter: t: the running thread
return: true if the thread was stopped successfully

