Class ShutdownThreadManager
- java.lang.Object
-
- java.lang.Thread
-
- io.testproject.sdk.internal.helpers.ShutdownThreadManager
-
- All Implemented Interfaces:
java.lang.Runnable
public final class ShutdownThreadManager extends java.lang.ThreadWill be used to manage the driver and AgentClient shutdown threads to ensure the AgentClient will not close before the driver finishes reporting.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAgentClient(java.lang.Runnable shutdownThread)Add Agent Client shutdown thread to the manager.voidaddDriver(java.lang.Object driver, java.lang.Runnable driverShutdownThread)Add a driver shutdown thread to the manager.static ShutdownThreadManagergetInstance()Singleton will return the current instance of the class.voidremoveAgentClient()Remove Agent Client shutdown thread from the manager.voidremoveDriver(java.lang.Object driver)Remote the driver shutdown thread from the manager.voidrun()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
-
-
-
-
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:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
-