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

An extension of [Thread](Thread) supporting the execution of [Callable](Callable) as well as [Runnable](Runnable). Two additional `get()` and `get(timeout)` methods, not unlike [Future](Future)'s get\(\), allow querying and waiting for the execution result. When executing a Runnable, get\(\) will always return null. An exception occurring during the execution of the thread is collected and re\-thrown inside an [ExecutionException](ExecutionException) object.

## Constructor: ThreadEx
- parameter: `runnable`, type: `java.lang.Runnable`

Description: Create a thread that executes a runnable.
parameter: runnable: non\-null runnable to execute

## Constructor: ThreadEx
- parameter: `callable`, type: `java.util.concurrent.Callable<V>`

Description: Create a thread that executes a callable.
parameter: callable: non\-null callable to execute

## Method: get
- return type: `V`

Description: Waits if necessary for the computation to complete, and then retrieves its result.
return: the computed result; always null for a [Runnable](Runnable)
throws: if the computation threw an exception
throws: if the current thread was interrupted while waiting

## Method: get
- parameter: `millis`, type: `long`
- return type: `V`

Description: Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.
parameter: millis: the maximum time to wait, in milliseconds; 0 means wait forever
return: the computed result; always null for a [Runnable](Runnable)
throws: if the computation threw an exception
throws: if the current thread was interrupted while waiting
throws: if the wait timed out

## Method: run

Description: Execute the configured runnable or callable.

