> Hi all,
> I want to ask for your opinion about adding *getPID *method in
> With Michael Osipov we talked about ensuring PID observed from Maven
> We need to read PID of Maven process within Surefire plugin. We have
> several alternatives however only Java 9 introduced standard API providing
> the PID.
> For me it would be fine to get the PID from MavenSession rather than
> discovering it in an individual Maven plugin since it is Maven's
> information and all plugins may read it too.
> For Java < 9 the JNA call can read PID. We found sources at Hudson which
> may help us https://github.com/hudson3-plugins/jna-native-support-plugin >
> As a standard Java way we can call Java 9 Jigsaw code:
> long pid = ProcessHandle.current().pid();
> Linux standard way is to read the link on file system
> String pid = new File("/proc/self").getCanonicalFile().getName()
> Non-standard simplistic way
> String pid = ManagementFactory.getRuntimeMXBean().getName().split("@")
> Bad fact on JMX is the startup cca 50 - 80 milliseconds.