|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.pmease.quickbuild.execution.killtree.ProcessTree
public abstract class ProcessTree
Represents a snapshot of the process tree of the current system.
A ProcessTree
is really conceptually a map from process ID to a
ProcessTree.OSProcess
object. When Hudson runs on platforms that support process
introspection, this allows you to introspect and do some useful things on
processes. On other platforms, the implementation falls back to "do nothing"
behavior.
ProcessTree
is remotable.
Nested Class Summary | |
---|---|
class |
ProcessTree.OSProcess
Represents a process. |
class |
ProcessTree.UnixProcess
A process. |
Field Summary | |
---|---|
static boolean |
enabled
Flag to control this feature. |
protected java.util.Map<java.lang.Integer,ProcessTree.OSProcess> |
processes
To be filled in the constructor of the derived type. |
Method Summary | |
---|---|
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. |
ProcessTree.OSProcess |
get(int pid)
Gets the process given a specific ID, or null if no such process exists. |
abstract ProcessTree.OSProcess |
get(java.lang.Process proc)
Try to convert ProcessTree.OSProcess into this process object or null if it
fails (for example, maybe the snapshot is taken after this process has
already finished.) |
java.util.Iterator<ProcessTree.OSProcess> |
iterator()
Lists all the processes in the system. |
abstract void |
killAll(java.util.Map<java.lang.String,java.lang.String> modelEnvVars,
boolean forcibly)
Kills all the processes that have matching environment variables. |
void |
killAll(java.lang.Process proc,
java.util.Map<java.lang.String,java.lang.String> modelEnvVars,
boolean forcibly)
Convenience method that does #killAll(Map) and
OSProcess#killRecursively() . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final java.util.Map<java.lang.Integer,ProcessTree.OSProcess> processes
public static boolean enabled
This feature involves some native code, so we are allowing the user to disable this in case there's a fatal problem.
This property supports two names for a compatibility reason.
Method Detail |
---|
public final ProcessTree.OSProcess get(int pid)
public final java.util.Iterator<ProcessTree.OSProcess> iterator()
iterator
in interface java.lang.Iterable<ProcessTree.OSProcess>
public abstract ProcessTree.OSProcess get(java.lang.Process proc)
ProcessTree.OSProcess
into this process object or null if it
fails (for example, maybe the snapshot is taken after this process has
already finished.)
public abstract void killAll(java.util.Map<java.lang.String,java.lang.String> modelEnvVars, boolean forcibly) throws java.lang.InterruptedException
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.
killAll
in interface ProcessTreeRemoting.IProcessTree
java.lang.InterruptedException
public void killAll(java.lang.Process proc, java.util.Map<java.lang.String,java.lang.String> modelEnvVars, boolean forcibly) throws java.lang.InterruptedException
#killAll(Map)
and
OSProcess#killRecursively()
. This is necessary to reliably kill
the process and its descendants, as some OS may not implement
#killAll(Map)
.
Either of the parameter can be null.
java.lang.InterruptedException
public static ProcessTree get()
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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |