|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.counters.PIDUtil
public class PIDUtil
Utility to return the PID of the JVM.
| Constructor Summary | |
|---|---|
PIDUtil()
|
|
| Method Summary | |
|---|---|
static int |
getLinuxPIDWithBash()
Return the PID of the Java VM under Linux using bash. |
static int |
getPID()
Tries each of the methods in this class and returns the PID as reported by the first method that succeeds. |
static int |
getPIDWithRuntimeMXBean()
Return the JVM PID. |
static void |
main(String[] args)
Utility for checking which method works on your platform. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PIDUtil()
| Method Detail |
|---|
public static int getLinuxPIDWithBash()
RuntimeException - if anything goes wrong.public static int getPIDWithRuntimeMXBean()
UnsupportedOperationException - if the pid can not be extracted.RuntimeMXBean#getName(), A web search will show that this is
generally of the form "pid@host". However this is definitely NOT
guaranteed by the javadoc.public static int getPID()
public static void main(String[] args)
throws InterruptedException
args -
InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||