public static Optional<String> getPortOwner(final int port) {
        if (port <= 0) {
            return Optional.empty();
        }

        Process process;
        try {
            process = Runtime.getRuntime().exec(new String[] {"netstat", getNestatOptions()});
        } catch (Exception e) {
            LOGGER.warn("exec netstat fail. {}", e.getMessage());
            return Optional.empty();
        }

        try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()))) {
            String line;
            while (Objects.nonNull(line = bufferedReader.readLine())) {
                if (!line.contains("LISTEN") || !line.contains(":" + port + " ")) {
                    continue;
                }
                String[] fields = line.trim().split(" ");
                Matcher matcher = PID_PATTERN.matcher(fields[fields.length - 1]);
                if (matcher.find()) {
                    return Optional.of(matcher.group(0));
                }
            }
        } catch (Exception e) {
            LOGGER.warn("get netstat input stream fail. {}", e.getMessage());
        } finally {
            if (Objects.nonNull(process)) {
                process.destroy();
            }
        }

        return Optional.empty();
    }
Get the PID of the listening port.

@param port the port
@return Optional PID
shenyu-register-center/shenyu-register-client/shenyu-register-client-http/src/main/java/org/apache/shenyu/register/client/http/utils/RuntimeUtils.java