Class ShutdownThreadManager

  • All Implemented Interfaces:
    java.lang.Runnable

    public final class ShutdownThreadManager
    extends java.lang.Thread
    Will be used to manage the driver and AgentClient shutdown threads to ensure the AgentClient will not close before the driver finishes reporting.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Field Summary

      • Fields inherited from class java.lang.Thread

        MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAgentClient​(java.lang.Runnable shutdownThread)
      Add Agent Client shutdown thread to the manager.
      void addDriver​(java.lang.Object driver, java.lang.Runnable driverShutdownThread)
      Add a driver shutdown thread to the manager.
      static ShutdownThreadManager getInstance()
      Singleton will return the current instance of the class.
      void removeAgentClient()
      Remove Agent Client shutdown thread from the manager.
      void removeDriver​(java.lang.Object driver)
      Remote the driver shutdown thread from the manager.
      void run()
      Run each shutdown hook in order starting from the drivers then the Agent Client.
      • Methods inherited from class java.lang.Thread

        activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • addAgentClient

        public void addAgentClient​(java.lang.Runnable shutdownThread)
        Add Agent Client shutdown thread to the manager.
        Parameters:
        shutdownThread - of the agent client.
      • removeAgentClient

        public void removeAgentClient()
        Remove Agent Client shutdown thread from the manager.
      • addDriver

        public void addDriver​(java.lang.Object driver,
                              java.lang.Runnable driverShutdownThread)
        Add a driver shutdown thread to the manager.
        Parameters:
        driver - added to the manager.
        driverShutdownThread - the shutdown thread.
      • removeDriver

        public void removeDriver​(java.lang.Object driver)
        Remote the driver shutdown thread from the manager.
        Parameters:
        driver - removed from the manager.
      • getInstance

        public static ShutdownThreadManager getInstance()
        Singleton will return the current instance of the class.
        Returns:
        instance of the class.
      • run

        public void run()
        Run each shutdown hook in order starting from the drivers then the Agent Client. Called when the program finishes to ensure drivers finish before the AgentClient.
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread