Class JvmPidDiscoverer
java.lang.Object
org.apache.druid.java.util.metrics.JvmPidDiscoverer
- All Implemented Interfaces:
PidDiscoverer
For systems that for whatever reason cannot use Sigar (through org.apache.druid.java.util.metrics.SigarPidDiscoverer ),
this attempts to get the PID from the JVM "name".
-
Method Summary
Modifier and TypeMethodDescriptionlonggetPid()Returns the PID as a best guess.static JvmPidDiscovererinstance()
-
Method Details
-
instance
-
getPid
public long getPid()Returns the PID as a best guess. This uses methods that are not guaranteed to actually be the PID.TODO: switch to ProcessHandle.current().getPid() for java9 potentially
- Specified by:
getPidin interfacePidDiscoverer- Returns:
- the PID of the current jvm if available
- Throws:
RuntimeException- if the pid cannot be determined
-