aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2023-02-22 01:06:06 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2023-02-22 01:06:06 +0100
commit2a2a208fa1651e0558755c4804a2a9db1433a345 (patch)
tree13cd33102bb1a8785d1a0110df5219ab2c48f425 /org.eclipse.jgit/src/org/eclipse/jgit
parentaa13d1daf581b296ed02fabecafb7539d85438eb (diff)
downloadjgit-2a2a208fa1651e0558755c4804a2a9db1433a345.tar.gz
jgit-2a2a208fa1651e0558755c4804a2a9db1433a345.zip
Use Java 11 ProcessHandle to get pid of the current process
Change-Id: I790f218601c1d5e1b39c4101e3b2708e76b9d782
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java12
1 files changed, 1 insertions, 11 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
index 4e8164c77f..080af97cbc 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
@@ -1713,17 +1713,7 @@ public class GC {
}
private long getPID() {
- String processName = java.lang.management.ManagementFactory
- .getRuntimeMXBean().getName();
- if (processName != null && processName.length() > 0) {
- try {
- return Long.parseLong(processName.split("@")[0]); //$NON-NLS-1$
- } catch (Exception e) {
- return 0;
- }
- }
-
- return 0;
+ return ProcessHandle.current().pid();
}
private String getHostName() {