code: private String getOwnProcessId() {
          // Format of name is : <pid>@<host>
          String name = ManagementFactory.getRuntimeMXBean().getName();
          int endIdx = name.indexOf('@');
          return endIdx != -1 ? name.substring(0,endIdx) : name;
      }
docs: whole agent, so it should be safe