Skip to content

Commit 8c57602

Browse files
committed
Remove dependency on JNA
This was only used to enable us to forcibly kill processes on Windows. Java 8 introduced a pure Java way of doing this, which we now use in preference.
1 parent 60fd55c commit 8c57602

13 files changed

+9
-301
lines changed

.idea/libraries/jna.xml

-13
This file was deleted.

java/client/.classpath

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
<classpathentry kind="lib" path="/third-party/java/htmlunit/neko-htmlunit-2.27.jar" sourcepath="/third-party/java/htmlunit/neko-htmlunit-2.27-sources.jar"/>
1212
<classpathentry kind="lib" path="/third-party/java/htmlunit/htmlunit-core-js-2.27.jar" sourcepath="/third-party/java/htmlunit/htmlunit-core-js-2.27-sources.jar"/>
1313
<classpathentry kind="lib" path="/third-party/java/selenium/htmlunit-driver-2.27.jar" sourcepath="/third-party/java/selenium/htmlunit-driver-2.27.jar"/>
14-
<classpathentry kind="lib" path="/third-party/java/jna/jna-4.1.0.jar" sourcepath="/third-party/java/jna/jna-4.1.0-src.jar"/>
15-
<classpathentry kind="lib" path="/third-party/java/jna/jna-platform-4.1.0.jar" sourcepath="/third-party/java/jna/jna-platform-4.1.0-src.jar"/>
1614
<classpathentry kind="lib" path="/third-party/java/commons/commons-exec-1.3.jar" sourcepath="/third-party/java/commons/commons-exec-1.3-sources.jar"/>
1715
<classpathentry kind="lib" path="/third-party/java/jetty/jetty-repacked.jar"/>
1816
<classpathentry kind="lib" path="/third-party/java/jetty/jetty-util-9.4.5.v20170502.jar" sourcepath="/third-party/java/jetty/jetty-util-9.4.5.v20170502-sources.jar"/>

java/client/src/org/openqa/selenium/os/BUCK

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ java_library(
99
'//java/client/src/org/openqa/selenium/io:io',
1010
'//third_party/java/commons:commons-exec',
1111
'//third_party/java/guava:guava',
12-
'//third_party/java/jna:jna',
1312
],
1413
visibility = [
1514
'//java/client/src/org/openqa/selenium:selenium',

java/client/src/org/openqa/selenium/os/Kernel32.java

-29
This file was deleted.

java/client/src/org/openqa/selenium/os/ProcessUtils.java

-217
This file was deleted.

java/client/src/org/openqa/selenium/os/UnixProcess.java

+9-10
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ class UnixProcess implements OsProcess {
5454
private final Executor executor = new DaemonExecutor();
5555

5656
private volatile OutputStream drainTo;
57-
private SeleniumWatchDog executeWatchdog = new SeleniumWatchDog(
58-
ExecuteWatchdog.INFINITE_TIMEOUT);
57+
private SeleniumWatchDog executeWatchdog = new SeleniumWatchDog(ExecuteWatchdog.INFINITE_TIMEOUT);
5958
private PumpStreamHandler streamHandler;
6059

6160
private final org.apache.commons.exec.CommandLine cl;
@@ -148,8 +147,7 @@ public int destroy() {
148147
return getExitCode();
149148
}
150149

151-
log.severe(String.format("Unable to kill process with PID %s",
152-
watchdog.getPID()));
150+
log.severe(String.format("Unable to kill process %s", watchdog.process));
153151
int exitCode = -1;
154152
executor.setExitValue(exitCode);
155153
return exitCode;
@@ -236,10 +234,6 @@ public void reset() {
236234
starting = true;
237235
}
238236

239-
private String getPID() {
240-
return String.valueOf(ProcessUtils.getProcessId(process));
241-
}
242-
243237
private void waitForProcessStarted() {
244238
while (starting) {
245239
try {
@@ -262,8 +256,13 @@ private void waitForTerminationAfterDestroy(int duration, TimeUnit unit) {
262256
}
263257

264258
private void destroyHarder() {
265-
ProcessUtils.killProcess(process);
259+
try {
260+
Process awaitFor = this.process.destroyForcibly();
261+
awaitFor.waitFor(10, SECONDS);
262+
} catch (InterruptedException e) {
263+
Thread.interrupted();
264+
throw new RuntimeException(e);
265+
}
266266
}
267267
}
268-
269268
}

third_party/java/jna/BUCK

-29
This file was deleted.
-132 KB
Binary file not shown.
-132 KB
Binary file not shown.

third_party/java/jna/jna-4.1.0.jar

-893 KB
Binary file not shown.
Binary file not shown.
-526 KB
Binary file not shown.
-1.4 MB
Binary file not shown.

0 commit comments

Comments
 (0)