Package org.wildfly.core.launcher
Class ProcessHelper
- java.lang.Object
-
- org.wildfly.core.launcher.ProcessHelper
-
public class ProcessHelper extends Object
A helper class to help with managing a process.- Author:
- James R. Perkins
-
-
Constructor Summary
Constructors Constructor Description ProcessHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ThreadaddShutdownHook(Process process)Adds a shutdown hook for the process.static intdestroyProcess(Process process)Destroys the process if the process is notnull.static booleanprocessHasDied(Process process)Checks to see if the process has died.
-
-
-
Method Detail
-
processHasDied
public static boolean processHasDied(Process process)
Checks to see if the process has died.- Parameters:
process- the process to check- Returns:
trueif the process has died, otherwisefalse
-
destroyProcess
public static int destroyProcess(Process process) throws InterruptedException
Destroys the process if the process is notnull.- Parameters:
process- the process to destroy, terminate- Returns:
- 0 if the process was successfully destroyed
- Throws:
InterruptedException
-
addShutdownHook
public static Thread addShutdownHook(Process process)
Adds a shutdown hook for the process.- Parameters:
process- the process to add a shutdown hook for- Returns:
- the thread set as the shutdown hook
- Throws:
SecurityException- If a security manager is present and it deniesRuntimePermission("shutdownHooks")
-
-