Hi Andrew,

I can help you with this contribution.

First question: Do you want to create a fix completely resolving Roger's bug 
8074569 [1] or shall I create a new bug for you? In the latter case, please 
send me a title and a long text (you can send this in a private Email).

Then, when we have the bug, you'll need to create a WebRev and post it for 
review. Are you familiar with that process? Do you have some close colleague 
who can assist you with that and upload a WebRev to cr.openjdk.java.net? If not 
I can do that for you when you send me the data. We can discuss that in a 
private mail thread as well.

Best regards
Christoph

[1] https://bugs.openjdk.java.net/browse/JDK-8074569

From: serviceability-dev [mailto:serviceability-dev-boun...@openjdk.java.net] 
On Behalf Of Andrew Leonard
Sent: Donnerstag, 22. Juni 2017 18:31
To: serviceability-dev@openjdk.java.net
Subject: Fw: Proposal:JdpController.getProcessId() VM compatibility improvement

Hello,
I would like to propose the change below to the JdpController.getProcessId() 
method which currently uses a reflection hack and the VMManagement interface. 
Instead for JDK9+ we can use the ProcessHandle.current().getPid() method, which 
will also allow better compatibility with other pluggable VMs.

jdk/src/jdk.management.agent/share/classes/sun/management/jdp/JdpController.java
36d35
< import sun.management.VMManagement;
136,149c135,136
<         try {
<             // Get the current process id using a reflection hack
<             RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
<             Field jvm = runtime.getClass().getDeclaredField("jvm");
<             jvm.setAccessible(true);
<
<             VMManagement mgmt = (sun.management.VMManagement) 
jvm.get(runtime);
<             Method pid_method = 
mgmt.getClass().getDeclaredMethod("getProcessId");
<             pid_method.setAccessible(true);
<             Integer pid = (Integer) pid_method.invoke(mgmt);
<             return pid;
<         } catch(Exception ex) {
<             return null;
<         }
---
>         // Get the current process id
>         return (int)ProcessHandle.current().getPid();

I'd appreciate any feedback please, and help obtaining a suitable sponsor and 
contributor?

Thanks
Andrew

Andrew Leonard
Java Runtimes Development
IBM Hursley
IBM United Kingdom Ltd
Phone internal: 245913, external: 01962 815913
internet email: andrew_m_leon...@uk.ibm.com<mailto:andrew_m_leon...@uk.ibm.com>

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU


Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

Reply via email to