Class ThreadMonitor

java.lang.Object
com.pnfsoftware.jeb.util.concurrent.ThreadMonitor

public class ThreadMonitor extends Object
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.
  • 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 not
      started - false if the thread was not started by the caller, in which case it will be started right before monitoring takes place
      moninfo - information for the monitor
      before - optional routine run before monitoring occurs
      after - optional routine run after monitoring is done
  • Method Details

    • getMonitoredThread

      public Thread getMonitoredThread()
    • getState

      public ThreadMonitor.State getState()
    • isReady

      public boolean isReady()
    • isMonitoring

      public boolean isMonitoring()
    • isTerminated

      public boolean isTerminated()
    • start

      public Thread start(boolean blocking)