org.apache.hadoop.util
Class ProcessTree

java.lang.Object
  extended by org.apache.hadoop.util.ProcessTree
Direct Known Subclasses:
ProcfsBasedProcessTree

public class ProcessTree
extends Object

Process tree related operations


Nested Class Summary
static class ProcessTree.Signal
          The constants for the signals.
 
Field Summary
static boolean isSetsidAvailable
           
 
Constructor Summary
ProcessTree()
           
 
Method Summary
static boolean isAlive(String pid)
          Is the process with PID pid still alive? This method assumes that isAlive is called on a pid that was alive not too long ago, and hence assumes no chance of pid-wrapping-around.
static boolean isProcessGroupAlive(String pgrpId)
          Is the process group with still alive? This method assumes that isAlive is called on a pid that was alive not too long ago, and hence assumes no chance of pid-wrapping-around.
static void killProcess(String pid, ProcessTree.Signal signal)
          Sends signal to process, forcefully terminating the process.
static void killProcessGroup(String pgrpId, ProcessTree.Signal signal)
          Sends signal to all process belonging to same process group, forcefully terminating the process group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

isSetsidAvailable

public static final boolean isSetsidAvailable
Constructor Detail

ProcessTree

public ProcessTree()
Method Detail

killProcess

public static void killProcess(String pid,
                               ProcessTree.Signal signal)
Sends signal to process, forcefully terminating the process.

Parameters:
pid - process id
signal - the signal number to send

killProcessGroup

public static void killProcessGroup(String pgrpId,
                                    ProcessTree.Signal signal)
Sends signal to all process belonging to same process group, forcefully terminating the process group.

Parameters:
pgrpId - process group id
signal - the signal number to send

isAlive

public static boolean isAlive(String pid)
Is the process with PID pid still alive? This method assumes that isAlive is called on a pid that was alive not too long ago, and hence assumes no chance of pid-wrapping-around.

Parameters:
pid - pid of the process to check.
Returns:
true if process is alive.

isProcessGroupAlive

public static boolean isProcessGroupAlive(String pgrpId)
Is the process group with still alive? This method assumes that isAlive is called on a pid that was alive not too long ago, and hence assumes no chance of pid-wrapping-around.

Parameters:
pgrpId - process group id
Returns:
true if any of process in group is alive.


Copyright © 2009 The Apache Software Foundation