On Tue, 6 Oct 2020 23:08:40 GMT, Igor Ignatyev <iignat...@openjdk.org> wrote:
> Hi all, > > could you please review this small cleanup which replaces > `ManagementFactory.getRuntimeMXBean().getName().split("@")[0]` w/ > `ProcessHandle.current().pid()` to get current > process pid? Thanks, > -- Igor All of these changes can call `ProcessHandle.current().toString()` to return pid of the current process. test/failure_handler/test/sanity/Suicide.java line 36: > 34: String osName = System.getProperty("os.name"); > 35: if (osName.contains("Windows")) { > 36: cmd = "taskkill.exe /F /PID " + pidStr; This can be simplified to ProcessHandle.current().toString(). It returns the pid of the process as a string. Explicitly converting it to a string is not necessary. The "+" concatenation would convert the number to a string. ------------- Changes requested by rriggs (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/534