code: private static String getMyPid() {
      String pid = "0";
      try {
        final String nameStr = ManagementFactory.getRuntimeMXBean().getName();
  
        // XXX (bjorn): Really stupid parsing assuming that nameStr will be of the form
        // "pid@hostname", which is probably not guaranteed.
        pid = nameStr.split("@")[0];
      } catch (RuntimeException e) {
        // Fall through.
      }
      return pid;
    }
docs: Also, the portability of this function is not guaranteed.