@Robert Do you know if JNA using com.sun packages was re-packaged due to Jigsaw? I think Jigsaw will not load com.sun packages.
On Sun, Jul 16, 2017 at 5:12 PM, Tibor Digana <tibor.dig...@googlemail.com> wrote: > Hi all, > > I want to ask for your opinion about adding *getPID *method in > MavenSession. > > With Michael Osipov we talked about ensuring PID observed from Maven > process. > 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("@")[0] > > Bad fact on JMX is the startup cca 50 - 80 milliseconds. > > -- > Cheers > Tibor > -- Cheers Tibor