tomcat 源码分析之connector

GoodQt 2015-07-29

我们看下connector的startInternal方法

@Override
    protected void startInternal() throws LifecycleException {

        if (getPort() < 0) {
            throw new LifecycleException(sm.getString(
                    "coyoteConnector.invalidPort", Integer.valueOf(getPort())));
        }

        setState(LifecycleState.STARTING);

        try {
           //间接条用 JIoEndpoint 类的startInternal();方法启动监听
            protocolHandler.start();
        } catch (Exception e) {
            String errPrefix = "";
            if(this.service != null) {
                errPrefix += "service.getName(): \"" + this.service.getName() + "\"; ";
            }

            throw new LifecycleException
                (errPrefix + " " + sm.getString
                 ("coyoteConnector.protocolHandlerStartFailed"), e);
        }

        mapperListener.start();
    }

相关推荐

TiDBPingCAP / 0评论 2020-07-29