tomcat 源码分析之connector

我们看下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();
    }

猜你喜欢

转载自xuyunti.iteye.com/blog/2231409