RFR: 8127: Use ProcessHandle API to get PIDs
    Christoph Dreis 
    duke at openjdk.org
       
    Sun Oct 15 10:50:23 UTC 2023
    
    
  
On Sun, 15 Oct 2023 10:30:29 GMT, Christoph Langer <clanger at openjdk.org> wrote:
>> Hi,
>> 
>> this PR uses `ProcessHandle.current().pid()` that was introduced in Java 9 rather than parsing the output of `ManagementFactory.getRuntimeMXBean().getName()`.
>> 
>> If you think this is worthwhile, I'd appreciate a ticket and sponsoring.
>> 
>> Cheers,
>> Christoph
>
> core/org.openjdk.jmc.common/src/main/java/org/openjdk/jmc/common/util/Environment.java line 136:
> 
>> 134: 		try {
>> 135: 			return (int) ProcessHandle.current().pid();
>> 136: 		} catch (Exception e) {
> 
> I think the try/catch is not needed with ProcessHandle any more...
Should I remove this still?
-------------
PR Review Comment: https://git.openjdk.org/jmc/pull/522#discussion_r1359852747
    
    
More information about the jmc-dev
mailing list