Re: Adding a new method getPID() in MavenSession
Hi Tibor, assuming you're talking about http://repo1.maven.org/maven2/net/java/dev/jna/jna/4.4.0/jna-4.4.0.jar AFAIK there's no blacklist of bad packages, only a whitelist of packages per jar of exported packages as described in its module descriptor. So as long as the com.sun.jna package doesn't collide with any other package, there should be no issue. But I agree that with J9 it is a poor chosen package name, maybe they decide to rename it after all. Robert On Sun, 16 Jul 2017 17:51:08 +0200, Tibor Digana wrote: @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 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 - To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org For additional commands, e-mail: dev-h...@maven.apache.org
Re: Adding a new method getPID() in MavenSession
@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 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
Adding a new method getPID() in MavenSession
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