org.openqa.selenium.server.browserlaunchers
Class AsyncExecute

java.lang.Object
  extended by org.apache.tools.ant.taskdefs.Execute
      extended by org.openqa.selenium.server.browserlaunchers.AsyncExecute

public class AsyncExecute
extends org.apache.tools.ant.taskdefs.Execute

A handy wrapper around Ant's Execute class that can spawn a process and return the process handle so you can close it yourself later

Author:
dfabulich

Nested Class Summary
static class AsyncExecute.ProcessStillAliveException
          Thrown when a process remains alive after attempting to destroy it
 
Field Summary
 
Fields inherited from class org.apache.tools.ant.taskdefs.Execute
INVALID
 
Constructor Summary
AsyncExecute()
           
 
Method Summary
 java.lang.Process asyncSpawn()
          Copied from spawn, but actually returns the Process, instead of void
 int execute()
           
static boolean isAlive(java.lang.Process p)
          Is this process still running ?
static int killProcess(java.lang.Process process)
          Forcibly kills a process, using OS tools like "kill" as a last resort
protected  void setActualExecuteEnvironment()
           
 void setEnvironmentVariable(java.lang.String name, java.lang.String value)
           
 void setLibraryPath(java.lang.String newLibraryPath)
           
static void sleepTight(long timeout)
          Sleeps without explicitly throwing an InterruptedException
static void sleepTightInSeconds(long timeoutInSeconds)
          Sleeps without explicitly throwing an InterruptedException
static int waitForProcessDeath(java.lang.Process p, long timeout)
          Waits the specified timeout for the process to die
static java.io.File whichExec(java.lang.String exec)
          Searches the path for the specified executable
 
Methods inherited from class org.apache.tools.ant.taskdefs.Execute
closeStreams, getCommandline, getEnvironment, getExitValue, getProcEnvironment, isFailure, killedProcess, launch, runCommand, setAntRun, setCommandline, setEnvironment, setExitValue, setNewenvironment, setSpawn, setStreamHandler, setVMLauncher, setWorkingDirectory, spawn, toString, waitFor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsyncExecute

public AsyncExecute()
Method Detail

sleepTightInSeconds

public static void sleepTightInSeconds(long timeoutInSeconds)
Sleeps without explicitly throwing an InterruptedException

Parameters:
timeoutInSeconds - Sleep time in seconds.
Throws:
java.lang.RuntimeException - wrapping an InterruptedException if one gets thrown

sleepTight

public static void sleepTight(long timeout)
Sleeps without explicitly throwing an InterruptedException

Parameters:
timeout - the amout of time to sleep
Throws:
java.lang.RuntimeException - wrapping an InterruptedException if one gets thrown

asyncSpawn

public java.lang.Process asyncSpawn()
                             throws java.io.IOException
Copied from spawn, but actually returns the Process, instead of void

Returns:
the spawned process handle
Throws:
java.io.IOException

execute

public int execute()
            throws java.io.IOException
Overrides:
execute in class org.apache.tools.ant.taskdefs.Execute
Throws:
java.io.IOException

isAlive

public static boolean isAlive(java.lang.Process p)
Is this process still running ?


waitForProcessDeath

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


killProcess

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


whichExec

public static java.io.File whichExec(java.lang.String exec)
Searches the path for the specified executable

Parameters:
exec - the executable name to search for
Returns:
the executable, or null if the executable could not be found

setLibraryPath

public void setLibraryPath(java.lang.String newLibraryPath)

setEnvironmentVariable

public void setEnvironmentVariable(java.lang.String name,
                                   java.lang.String value)

setActualExecuteEnvironment

protected void setActualExecuteEnvironment()


Copyright © 2010. All Rights Reserved.