Class ProcessHelper


  • public class ProcessHelper
    extends Object
    A helper class to help with managing a process.
    Author:
    James R. Perkins
    • Constructor Detail

      • ProcessHelper

        public ProcessHelper()
    • Method Detail

      • processHasDied

        @Deprecated(forRemoval=true)
        public static boolean processHasDied​(Process process)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Checks to see if the process has died.
        Parameters:
        process - the process to check
        Returns:
        true if the process has died, otherwise false
        See Also:
        Process.isAlive()
      • destroyProcess

        public static int destroyProcess​(Process process)
                                  throws InterruptedException
        Destroys the process if the process is not null.
        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 denies RuntimePermission("shutdownHooks")