Class ThreadMonitor
java.lang.Object
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
).
The monitor itself can be executed as a separate thread.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionThreadMonitor
(Thread thread, boolean started, IMonitorInfoProvider moninfo, Runnable before, Runnable after) Create a new thread monitor instance. -
Method Summary
-
Constructor Details
-
ThreadMonitor
public ThreadMonitor(Thread thread, boolean started, IMonitorInfoProvider moninfo, Runnable before, Runnable after) Create a new thread monitor instance.- Parameters:
thread
- the thread to be monitored, started or notstarted
- false if the thread was not started by the caller, in which case it will be started right before monitoring takes placemoninfo
- information for the monitorbefore
- optional routine run before monitoring occursafter
- optional routine run after monitoring is done
-
-
Method Details
-
getMonitoredThread
-
getState
-
isReady
public boolean isReady() -
isMonitoring
public boolean isMonitoring() -
isTerminated
public boolean isTerminated() -
start
-