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

This class is used to monitor the execution of a target thread. That target thread thread can be forcefully stopped after a dynamic timeout has elapsed. The target thread should check for and respect interruption requests \([details](ThreadUtil#monitor(Thread, IMonitorInfoProvider))\). The monitor itself can be executed as a separate thread.

## Constructor: ThreadMonitor
- parameter: `thread`, type: `java.lang.Thread`
- parameter: `moninfo`, type: `com.pnfsoftware.jeb.util.concurrent.IMonitorInfoProvider`
- parameter: `before`, type: `java.lang.Runnable`
- parameter: `after`, type: `java.lang.Runnable`

Description: Create a new thread monitor instance.
parameter: thread: the non\-started thread object to be monitored
parameter: moninfo: information for the monitor
parameter: before: optional routine run before monitoring occurs
parameter: after: optional routine run after monitoring is done

## Method: getMonitoredThread
- return type: `java.lang.Thread`

Description: Get the monitored thread.
return: the thread passed to the constructor

## Method: getState
- return type: `com.pnfsoftware.jeb.util.concurrent.ThreadMonitor.State`

Description: Get the current monitor state.
return: the current state

## Method: isMonitoring
- return type: `boolean`

Description: Determine whether monitoring is in progress.
return: true if the monitor state is [State#MONITORING](State#MONITORING)

## Method: isReady
- return type: `boolean`

Description: Determine whether the monitor has not started yet.
return: true if the monitor state is [State#READY](State#READY)

## Method: isTerminated
- return type: `boolean`

Description: Determine whether monitoring has ended.
return: true if the monitor state is terminal

## Method: start
- parameter: `blocking`, type: `boolean`

Description: Start monitoring the target thread.
parameter: blocking: true to run monitoring in the current thread; false to run it on a daemon            thread

