Class ProcessTree.OSProcess
- java.lang.Object
-
- org.ow2.proactive.process_tree_killer.ProcessTree.OSProcess
-
- All Implemented Interfaces:
java.io.Serializable,ProcessTreeRemoting.IOSProcess
- Direct Known Subclasses:
ProcessTree.UnixProcess
- Enclosing class:
- ProcessTree
public abstract class ProcessTree.OSProcess extends java.lang.Object implements ProcessTreeRemoting.IOSProcess, java.io.Serializable
Represents a process.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.util.List<java.lang.String>getArguments()Gets the command-line arguments of this process.java.util.List<ProcessTree.OSProcess>getChildren()Immediate child processes.abstract EnvVarsgetEnvironmentVariables()Obtains the environment variables of this process.abstract ProcessTree.OSProcessgetParent()Gets the parent process.intgetPid()booleanhasMatchingEnvVars(java.util.Map<java.lang.String,java.lang.String> modelEnvVar)Given the environment variable of a process and the "model environment variable" that Hudson used for launching the build, returns true if there's a match (which means the process should be considered a descendant of a build.)abstract voidkill()Kills this process.abstract voidkillRecursively()Kills this process and all the descendants.
-
-
-
Method Detail
-
getPid
public final int getPid()
- Specified by:
getPidin interfaceProcessTreeRemoting.IOSProcess
-
getParent
public abstract ProcessTree.OSProcess getParent()
Gets the parent process. This method may return null, because there's no guarantee that we are getting a consistent snapshot of the whole system state.- Specified by:
getParentin interfaceProcessTreeRemoting.IOSProcess
-
getChildren
public final java.util.List<ProcessTree.OSProcess> getChildren()
Immediate child processes.
-
kill
public abstract void kill() throws java.lang.InterruptedExceptionKills this process.- Specified by:
killin interfaceProcessTreeRemoting.IOSProcess- Throws:
java.lang.InterruptedException
-
killRecursively
public abstract void killRecursively() throws java.lang.InterruptedExceptionKills this process and all the descendants.Note that the notion of "descendants" is somewhat vague, in the presence of such things like daemons. On platforms where the recursive operation is not supported, this just kills the current process.
- Specified by:
killRecursivelyin interfaceProcessTreeRemoting.IOSProcess- Throws:
java.lang.InterruptedException
-
getArguments
public abstract java.util.List<java.lang.String> getArguments()
Gets the command-line arguments of this process.On Windows, where the OS models command-line arguments as a single string, this method computes the approximated tokenization.
- Specified by:
getArgumentsin interfaceProcessTreeRemoting.IOSProcess
-
getEnvironmentVariables
public abstract EnvVars getEnvironmentVariables()
Obtains the environment variables of this process.- Specified by:
getEnvironmentVariablesin interfaceProcessTreeRemoting.IOSProcess- Returns:
- empty map if failed (for example because the process is already dead, or the permission was denied.)
-
hasMatchingEnvVars
public final boolean hasMatchingEnvVars(java.util.Map<java.lang.String,java.lang.String> modelEnvVar)
Given the environment variable of a process and the "model environment variable" that Hudson used for launching the build, returns true if there's a match (which means the process should be considered a descendant of a build.)
-
-