Only check `/proc/self` if apparently on Linux (always fall back to VM name)
@@ -271,6 +271,7 @@ public class DaemonRegistry implements AutoCloseable {
private static final int PROCESS_ID = getProcessId0();
private static int getProcessId0() {
+ if (Os.current() == Os.LINUX) {
try {
final Path self = Paths.get("/proc/self");
if (Files.exists(self)) {
@@ -289,6 +290,7 @@ public class DaemonRegistry implements AutoCloseable {
} catch (IOException ignored) {
LOGGER.debug("could not load /proc/self", ignored);
}
+ }
String vmname = ManagementFactory.getRuntimeMXBean().getName();
String pid = vmname.split("@", 0)[0];
LOGGER.debug("loading own PID from VM name: {}", pid);
