Class ProcessTreeTerminator


  • public abstract class ProcessTreeTerminator
    extends Object
    Author:
    Kir, Eugene Petrenko
    • Field Detail

      • LOG

        public static final org.apache.log4j.Logger LOG
      • DEFAULT_COMMAND_DELAY

        protected static final int DEFAULT_COMMAND_DELAY
        See Also:
        Constant Field Values
    • Constructor Detail

      • ProcessTreeTerminator

        protected ProcessTreeTerminator()
    • Method Detail

      • init

        public static void init()
        Initializes process tree terminator
      • kill

        public static boolean kill​(@Nullable
                                   Long pid,
                                   KillProcessDetails killProcessDetails)
        Kills process specified by pid and it's subprocesses matched by specified filter. If pid parameter is null, kills current process's subtree. Avoids killing current process
        Parameters:
        pid - process pid
        killProcessDetails - kill process details
        Returns:
        should return the actual status if the process was killed, but current implementation may return true even if the process was not killed.
      • kill

        public static boolean kill​(KillProcessDetails killProcessDetails)
        Kills child processes matched by specified filter.
        Parameters:
        killProcessDetails - kill process details
        Returns:
        should return the actual status if the process was killed, but the current implementation may return true even if the process was not killed.
      • getChildProcesses

        public static Collection<ProcessNode> getChildProcesses​(@Nullable
                                                                Long pid,
                                                                @NotNull
                                                                ProcessFilter filter)
        Returns child processes of the process specified by rge pid matched by the specified filter
        Parameters:
        filter - process filter
        Returns:
        collection of child processes
      • getChildProcesses

        public static Collection<ProcessNode> getChildProcesses​(@NotNull
                                                                ProcessFilter filter)
        Returns child processes matched by the specified filter
        Parameters:
        filter - process filter
        Returns:
        collection of child processes
      • getCurrentPid

        public static long getCurrentPid()
        Gets current process's pid. This operation may take appreciable timed ue to process tree rebuild
        Returns:
        process pid