diff --git a/pitest-entry/src/main/java/org/pitest/process/Java9Process.java b/pitest-entry/src/main/java/org/pitest/process/Java9Process.java index abbcd5255..5f019c574 100644 --- a/pitest-entry/src/main/java/org/pitest/process/Java9Process.java +++ b/pitest-entry/src/main/java/org/pitest/process/Java9Process.java @@ -26,10 +26,6 @@ public class Java9Process implements WrappingProcess { private final Class minionClass; private JavaProcess process; - private final long pid = ProcessHandle.current().pid(); - - private static int counter = 0; - public Java9Process(int port, ProcessArgs args, Class minionClass) { this.port = port; this.processArgs = args; @@ -124,12 +120,10 @@ private List createLaunchArgs(JavaAgent agentJarLocator, List ar } private Path createArgsFile(List cmd) throws IOException { - // To avoid conflicts with running analysis, we use the PID as part of the file name - // To prevent conflicts between multiple threads counter is used // All files should be deleted on process exit, although some garbage may be left // if the process is killed. Files are however created in the system temp directory // so should be cleaned up on reboot - String name = "pitest-args-" + pid + "-" + nextCounter(); + String name = "pitest-args-"; Path args = Files.createTempFile(name, ".args"); args.toFile().deleteOnExit(); Files.write(args, cmd); @@ -157,8 +151,4 @@ private static Predicate isJavaAgentParam() { return a -> a.toLowerCase().startsWith("-javaagent"); } - private static synchronized int nextCounter() { - return counter++; - } - }