in impl/src/main/java/org/apache/rocketmq/remoting/internal/JvmUtils.java [68:91]
public static int getProcessId() {
String pid = null;
final File self = new File("/proc/self");
try {
if (self.exists()) {
pid = self.getCanonicalFile().getName();
}
} catch (IOException ignored) {
//Ignore it
}
if (pid == null) {
pid = ManagementFactory.getRuntimeMXBean().getName().split("@", 0)[0];
}
if (pid == null) {
int rpid = new Random().nextInt(1 << 16);
LOG.warn("Unable to determine PID, picked a random number {}", rpid);
return rpid;
} else {
return Integer.parseInt(pid);
}
}