Class BasicThreadPool.TimeoutMonitor

  • All Implemented Interfaces:
    java.lang.Runnable
    Enclosing class:
    BasicThreadPool

    private class BasicThreadPool.TimeoutMonitor
    extends java.lang.Object
    implements java.lang.Runnable
    The monitor runnable which validates that threads are completing within the task completion timeout limits.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) org.jboss.logging.Logger log  
    • Constructor Summary

      Constructors 
      Constructor Description
      TimeoutMonitor​(java.lang.String name, org.jboss.logging.Logger log)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void run()
      The monitor thread loops until the pool is shutdown.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • log

        final org.jboss.logging.Logger log
    • Constructor Detail

      • TimeoutMonitor

        TimeoutMonitor​(java.lang.String name,
                       org.jboss.logging.Logger log)
    • Method Detail

      • run

        public void run()
        The monitor thread loops until the pool is shutdown. It waits for tasks with completion timeouts and sleeps until the next completion timeout and then interrupts the associated task thread, and invokes stopTask on the TaskWrapper. A new timeout check is then inserted with a 1 second timeout to validate that the TaskWrapper has exited the run method. If it has not, then the associated task thread is stopped using the deprecated Thread.stop method since this is the only way to abort a thread that is in spin loop for example.
        Specified by:
        run in interface java.lang.Runnable