Class ProcessTreeTerminatorImplBase

    • Constructor Detail

      • ProcessTreeTerminatorImplBase

        public ProcessTreeTerminatorImplBase()
    • Method Detail

      • getPsPpidCommand

        @NotNull
        protected abstract String[] getPsPpidCommand()
      • getAlternativePsPpidCommand

        @Nullable
        protected String[] getAlternativePsPpidCommand()
      • killProcessTree

        public boolean killProcessTree​(@Nullable
                                       Long pid,
                                       @NotNull
                                       KillProcessDetails killProcessDetails,
                                       int commandTimeout)
        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
        Specified by:
        killProcessTree in interface ProcessTerminatorSupport
        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.
      • readCommandOutput

        protected List<String> readCommandOutput​(String[] command,
                                                 int delaySeconds)
      • kill

        protected void kill​(@NotNull
                            List<ProcessNode> nodes,
                            int delaySeconds,
                            @NotNull
                            KillProcessDetails killProcessDetails)
        Executes kill command according to the settings in killProcessDetails in the order of the nodes passed
      • layers

        @NotNull
        public static List<List<ProcessNode>> layers​(@NotNull
                                                     List<ProcessNode> items,
                                                     int maxLayers)
        returns the tree in the layered form, starting from the topmost nodes, but not more than maxLayers layers. Last layer contains all the remaining items