From c9201c7a588ef101bd4b25c6a038a22e51cf6ebc Mon Sep 17 00:00:00 2001 From: Stephen Salinas Date: Tue, 1 Oct 2019 11:47:42 -0400 Subject: [PATCH] Update ProcessUtils to work with java11 --- .../hubspot/singularity/runner/base/shared/ProcessUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SingularityRunnerBase/src/main/java/com/hubspot/singularity/runner/base/shared/ProcessUtils.java b/SingularityRunnerBase/src/main/java/com/hubspot/singularity/runner/base/shared/ProcessUtils.java index c48bb4cafa..a0b7c9b0df 100644 --- a/SingularityRunnerBase/src/main/java/com/hubspot/singularity/runner/base/shared/ProcessUtils.java +++ b/SingularityRunnerBase/src/main/java/com/hubspot/singularity/runner/base/shared/ProcessUtils.java @@ -97,7 +97,8 @@ public ProcessResult sendSignal(Signal signal, int pid) { } public int getUnixPID(Process process) { - Preconditions.checkArgument(process.getClass().getName().equals("java.lang.UNIXProcess")); + // older java versions have UNIXProcess, newer have ProcessImpl. Both have a pid field we can access + Preconditions.checkArgument(process.getClass().getName().equals("java.lang.UNIXProcess") || process.getClass().getName().equals("java.lang.ProcessImpl")); Class clazz = process.getClass();