org.openqa.selenium.os
Class ProcessUtils

java.lang.Object
  extended by org.openqa.selenium.os.ProcessUtils

public class ProcessUtils
extends Object


Nested Class Summary
static class ProcessUtils.ProcessStillAliveException
           
 
Constructor Summary
ProcessUtils()
           
 
Method Summary
static int getProcessId(Process p)
           
static void kill9(Integer pid)
          Runs "kill -9" on the specified pid
static void kill9(Process p)
          Runs "kill -9" on the specified process
static int killProcess(Process process)
          Forcibly kills a process, using OS tools like "kill" as a last resort
static int waitForProcessDeath(Process p, long timeout)
          Waits the specified timeout for the process to die
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcessUtils

public ProcessUtils()
Method Detail

waitForProcessDeath

public static int waitForProcessDeath(Process p,
                                      long timeout)
Waits the specified timeout for the process to die

Parameters:
p - The process to kill.
timeout - How long to wait in milliseconds.
Returns:
The exit code of the given process.

killProcess

public static int killProcess(Process process)
Forcibly kills a process, using OS tools like "kill" as a last resort

Parameters:
process - The process to kill.
Returns:
The exit value of the process.

getProcessId

public static int getProcessId(Process p)
Parameters:
p - The process to gather the PID of.
Returns:
The process's PID

kill9

public static void kill9(Integer pid)
                  throws IOException,
                         InterruptedException
Runs "kill -9" on the specified pid

Parameters:
pid - The PID of the process to kill.
Throws:
IOException - If unable to kill the process.
InterruptedException - If unable to kill the process.

kill9

public static void kill9(Process p)
                  throws IOException,
                         InterruptedException
Runs "kill -9" on the specified process

Parameters:
p - The process to kill.
Throws:
IOException - If unable to kill the process.
InterruptedException - If unable to kill the process.


Copyright © 2011. All Rights Reserved.