class AdminInitialization implements Initializable {
    // default values
    private static final String DEFAULT_ADMIN_SERVER = "netty4";
    private static final String SECOND_DEFAULT_ADMIN_SERVER = "netty3";
    private static final String DEFAULT_ADMIN_PROTOCOL = "http";

    @Override
    public void init() {
        try {
            int port = getAdminPort();
            if (port >= 0) { // create admin server
                String adminServerString = MotanGlobalConfigUtil.getConfig(MotanConstants.ADMIN_SERVER);
                AdminServerFactory adminServerFactory;
                // an exception will be thrown if AdminServerFactory is not found
                if (StringUtils.isNotBlank(adminServerString)) {
                    adminServerFactory = ExtensionLoader.getExtensionLoader(AdminServerFactory.class).getExtension(adminServerString);
                } else { // use default admin server
                    adminServerFactory = ExtensionLoader.getExtensionLoader(AdminServerFactory.class).getExtension(DEFAULT_ADMIN_SERVER, false);
                    if (adminServerFactory == null) {
                        adminServerFactory = ExtensionLoader.getExtensionLoader(AdminServerFactory.class).getExtension(SECOND_DEFAULT_ADMIN_SERVER);
                    }
                }

                // build admin server url
                URL adminUrl = new URL(MotanGlobalConfigUtil.getConfig(MotanConstants.ADMIN_PROTOCOL, DEFAULT_ADMIN_PROTOCOL), "127.0.0.1", port, "/",
                        MotanGlobalConfigUtil.getConfigs().entrySet().stream().filter((entry) -> entry.getKey().startsWith("admin.")).collect(Collectors.toMap((entry) -> entry.getKey().substring("admin.".length()), Map.Entry::getValue)));

                // add default command handlers;
                addDefaultHandlers();

                // add command handler extensions from config
                addExtHandlers(MotanGlobalConfigUtil.getConfig(MotanConstants.ADMIN_EXT_HANDLERS));

                // add command handler extensions from ENV
                addExtHandlers(System.getenv(MotanConstants.ENV_MOTAN_ADMIN_EXT_HANDLERS));

                // create admin server
                AdminServer adminServer = adminServerFactory.createServer(adminUrl, AdminUtil.getDefaultAdminHandler());
                adminServer.open();
                LoggerUtil.info("admin server is open. url:" + adminUrl.toFullStr());
            }
        } catch (Exception e) {
            LoggerUtil.error("admin server open fail.", e);
        }
    }

    private int getAdminPort() {
        int port = -1;
        // 'admin.disable' has the highest priority
        if ("true".equals(MotanGlobalConfigUtil.getConfig(MotanConstants.ADMIN_DISABLE))) {
            return port;
        }
        // get from env
        port = parsePort(System.getenv(MotanConstants.ENV_MOTAN_ADMIN_PORT));

        if (port < 0) { // get from global configs
            port = parsePort(MotanGlobalConfigUtil.getConfig(MotanConstants.ADMIN_PORT));
        }
        // default admin port
        if (port < 0) {
            port = MotanConstants.DEFAULT_ADMIN_PORT;
        }
        return port;
    }

    private int parsePort(String portStr) {<FILL_FUNCTION_BODY>}

    private void addDefaultHandlers() {
        AdminUtil.addCommandHandler(new CommandListHandler());
        AdminUtil.addCommandHandler(new RuntimeInfoHandler());
        AdminUtil.addCommandHandler(new MetaInfoHandler());
    }

    private void addExtHandlers(String handlerString) {
        if (handlerString != null) {
            String[] handlers = handlerString.split(",");
            for (String h : handlers) {
                if (StringUtils.isNotBlank(h)) {
                    try {
                        AdminCommandHandler handler = ExtensionLoader.getExtensionLoader(AdminCommandHandler.class).getExtension(h.trim());
                        AdminUtil.addCommandHandler(handler, true);
                        LoggerUtil.info("admin server add handler " + handler.getClass().getName());
                    } catch (Exception e) {
                        LoggerUtil.warn("can not find admin command handler :" + h);
                    }
                }
            }
        }
    }
}

        int port = -1;
        if (StringUtils.isNotBlank(portStr)) {
            try {
                port = Integer.parseInt(portStr);
            } catch (NumberFormatException e) {
                LoggerUtil.warn("AdminInitialization parse admin port from env fail. value:" + portStr);
            }
        }
        return port;
    
<no_super_class>