com.pmease.quickbuild.execution.killtree
Class ProcessTree.OSProcess

java.lang.Object
  extended by com.pmease.quickbuild.execution.killtree.ProcessTree.OSProcess
All Implemented Interfaces:
ProcessTreeRemoting.IOSProcess
Direct Known Subclasses:
ProcessTree.UnixProcess
Enclosing class:
ProcessTree

public abstract class ProcessTree.OSProcess
extends java.lang.Object
implements ProcessTreeRemoting.IOSProcess

Represents a process.


Method Summary
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  EnvVars getEnvironmentVariables()
          Obtains the environment variables of this process.
abstract  ProcessTree.OSProcess getParent()
          Gets the parent process.
 int getPid()
           
 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.)
abstract  void kill(boolean forcibly)
          Kills this process.
abstract  void killRecursively(boolean forcibly)
          Kills this process and all the descendants.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPid

public final int getPid()
Specified by:
getPid in interface ProcessTreeRemoting.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:
getParent in interface ProcessTreeRemoting.IOSProcess

getChildren

public final java.util.List<ProcessTree.OSProcess> getChildren()
Immediate child processes.


kill

public abstract void kill(boolean forcibly)
                   throws java.lang.InterruptedException
Kills this process.

Specified by:
kill in interface ProcessTreeRemoting.IOSProcess
Throws:
java.lang.InterruptedException

killRecursively

public abstract void killRecursively(boolean forcibly)
                              throws java.lang.InterruptedException
Kills 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:
killRecursively in interface ProcessTreeRemoting.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:
getArguments in interface ProcessTreeRemoting.IOSProcess

getEnvironmentVariables

public abstract EnvVars getEnvironmentVariables()
Obtains the environment variables of this process.

Specified by:
getEnvironmentVariables in interface ProcessTreeRemoting.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.)



Copyright © 2005-2010 PMEase Inc. All Rights Reserved.