Package hudson.util

Class ProcessTree

    • Method Detail

      • get

        @CheckForNull
        public final ProcessTree.OSProcess get​(int pid)
        Gets the process given a specific ID, or null if no such process exists.
      • get

        @CheckForNull
        public abstract ProcessTree.OSProcess get​(@NonNull
                                                  Process proc)
        Try to convert Process into this process object or null if it fails (for example, maybe the snapshot is taken after this process has already finished.)
      • killAll

        public abstract void killAll​(@NonNull
                                     Map<String,​String> modelEnvVars)
                              throws InterruptedException
        Kills all the processes that have matching environment variables.

        In this method, the method is given a "model environment variables", which is a list of environment variables and their values that are characteristic to the launched process. The implementation is expected to find processes in the system that inherit these environment variables, and kill them all. This is suitable for locating daemon processes that cannot be tracked by the regular ancestor/descendant relationship.

        Specified by:
        killAll in interface ProcessTreeRemoting.IProcessTree
        Throws:
        InterruptedException
      • get

        public static ProcessTree get()
        Gets the ProcessTree of the current system that JVM runs in, or in the worst case return the default one that's not capable of killing descendants at all.