public class DriverService
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DriverService.Builder<DS extends DriverService,B extends DriverService.Builder> |
Modifier and Type | Field and Description |
---|---|
private com.google.common.collect.ImmutableList<java.lang.String> |
args |
private com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> |
environment |
private java.lang.String |
executable |
private java.util.concurrent.locks.ReentrantLock |
lock
Controls access to
process . |
private CommandLine |
process
A reference to the current child process.
|
private java.net.URL |
url
The base URL for the managed server.
|
Modifier | Constructor and Description |
---|---|
protected |
DriverService(java.io.File executable,
int port,
com.google.common.collect.ImmutableList<java.lang.String> args,
com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> environment) |
Modifier and Type | Method and Description |
---|---|
protected static void |
checkExecutable(java.io.File exe) |
protected static java.io.File |
findExecutable(java.lang.String exeName,
java.lang.String exeProperty,
java.lang.String exeDocs,
java.lang.String exeDownload) |
java.net.URL |
getUrl() |
boolean |
isRunning()
Checks whether the driver child process is currently running.
|
void |
start()
Starts this service if it is not already running.
|
void |
stop()
Stops this service is it is currently running.
|
protected void |
waitUntilAvailable() |
private final java.net.URL url
private final java.util.concurrent.locks.ReentrantLock lock
process
.private CommandLine process
null
whenever this service is not
running. Protected by lock
.private final java.lang.String executable
private final com.google.common.collect.ImmutableList<java.lang.String> args
private final com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> environment
protected DriverService(java.io.File executable, int port, com.google.common.collect.ImmutableList<java.lang.String> args, com.google.common.collect.ImmutableMap<java.lang.String,java.lang.String> environment) throws java.io.IOException
executable
- The driver executable.port
- Which port to start the driver server on.args
- The arguments to the launched server.environment
- The environment for the launched server.java.io.IOException
- If an I/O error occurs.public java.net.URL getUrl()
protected static java.io.File findExecutable(java.lang.String exeName, java.lang.String exeProperty, java.lang.String exeDocs, java.lang.String exeDownload)
exeName
- Name of the executable file to look for in PATHexeProperty
- Name of a system property that specifies the path to the executable fileexeDocs
- The link to the driver documentation pageexeDownload
- The link to the driver download pageFile
objectjava.lang.IllegalStateException
- If the executable not found or cannot be executedprotected static void checkExecutable(java.io.File exe)
public boolean isRunning()
public void start() throws java.io.IOException
java.io.IOException
- If an error occurs while spawning the child process.stop()
protected void waitUntilAvailable() throws java.net.MalformedURLException
java.net.MalformedURLException
public void stop()
start()