org.openqa.selenium.remote.internal
Class SubProcess

java.lang.Object
  extended by org.openqa.selenium.remote.internal.SubProcess

public class SubProcess
extends Object

Basic class for working with subprocesses. Methods are provided for starting and stopping a subprocess. Also provides a mechanism for detecting if a subprocess dies before it is explicitly stopped.

Author:
[email protected] (Jason Leyba)

Constructor Summary
SubProcess(ProcessBuilder processBuilder)
          Creates a new SubProcess that will ignore all output from any spawned process.
SubProcess(ProcessBuilder processBuilder, OutputStream outputStream)
          Creates a new SubProcess that will redirect all output to the specified stream.
 
Method Summary
 int exitValue()
           
 boolean isRunning()
           
 void launch()
          Starts a new Process using this instance's ProcessBuilder.
 void shutdown()
          Shutsdown the Process currently being managed by this instance, if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubProcess

public SubProcess(ProcessBuilder processBuilder)
Creates a new SubProcess that will ignore all output from any spawned process.

Parameters:
processBuilder - Used to launch new processes.
See Also:
SubProcess(ProcessBuilder, OutputStream)

SubProcess

public SubProcess(ProcessBuilder processBuilder,
                  OutputStream outputStream)
Creates a new SubProcess that will redirect all output to the specified stream. The output written to stderr is always merged with the output to stdout.

Parameters:
processBuilder - Used to launch new processes.
outputStream - The stream to redirect all process output to.
Method Detail

launch

public void launch()
Starts a new Process using this instance's ProcessBuilder. If a Process is already running, this method will be a no-op.

Throws:
WebDriverException - If an I/O error occurs while starting the new process.

exitValue

public int exitValue()
Returns:
The exit value for the managed subprocess.
Throws:
IllegalThreadStateException - If the managed subprocess was never started, or if it was started but has not terminated yet.

isRunning

public boolean isRunning()
Returns:
Whether the managed subprocess is currently running.

shutdown

public void shutdown()
Shutsdown the Process currently being managed by this instance, if any.

See Also:
Process.destroy()


Copyright © 2011. All Rights Reserved.