Class JvmPidDiscoverer
- java.lang.Object
-
- org.apache.druid.java.util.metrics.JvmPidDiscoverer
-
- All Implemented Interfaces:
PidDiscoverer
public class JvmPidDiscoverer extends Object implements 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getPid()
Returns the PID as a best guess.static JvmPidDiscoverer
instance()
-
-
-
Method Detail
-
instance
public static JvmPidDiscoverer 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:
getPid
in interfacePidDiscoverer
- Returns:
- the PID of the current jvm if available
- Throws:
RuntimeException
- if the pid cannot be determined
-
-