Get the JVM Pid

/**
* Gets the pid of this JVM, because Java doesn't provide a real way to do this.
*
* @return
*/

public static String process_pid() {
String name = ManagementFactory.getRuntimeMXBean().getName();
String[] split = name.split("@");
if (split.length != 2) {
throw new RuntimeException("Got unexpected process name: " + name);
}

return split[0];
}