tomcat8关键性源码分析
来源:互联网 发布:python random.sample 编辑:程序博客网 时间:2024/05/18 16:38
tomcat8的连接配置如下:
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="1000" minSpareThreads="100" prestartminSpareThreads = "true" maxQueueSize = "100" />
<Connector port="8080" protocol="org.apache.coyote.http11.Http11Nio2Protocol" connectionTimeout="30000" redirectPort="8443" maxConnections="2000" executor="tomcatThreadPool" enableLookups="false" acceptCount="100" maxPostSize="-1" compression="on" disableUploadTimeout="true" compressionMinSize="2048" noCompressionUserAgents="gozilla, traviata" acceptorThreadCount="2" compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript,application/javascript" URIEncoding="utf-8" />protocol用的是:org.apache.coyote.http11.Http11Nio2Protocol,如果配置protocol="HTTP/1.1"就是用的
org.apache.coyote.http11.Http11NioProtocol,源代码如下,在Connector类中的Connector的构造方法:
public Connector(String protocol) { boolean aprConnector = AprLifecycleListener.isAprAvailable() && AprLifecycleListener.getUseAprConnector(); if ("HTTP/1.1".equals(protocol) || protocol == null) { if (aprConnector) { protocolHandlerClassName = "org.apache.coyote.http11.Http11AprProtocol"; } else { protocolHandlerClassName = "org.apache.coyote.http11.Http11NioProtocol"; } } else if ("AJP/1.3".equals(protocol)) { if (aprConnector) { protocolHandlerClassName = "org.apache.coyote.ajp.AjpAprProtocol"; } else { protocolHandlerClassName = "org.apache.coyote.ajp.AjpNioProtocol"; } } else { protocolHandlerClassName = protocol; }Executor中的maxThreads和maxConnections是在AbstractProcotol中,如下:
public int getMaxThreads() { return endpoint.getMaxThreads(); } public void setMaxThreads(int maxThreads) { endpoint.setMaxThreads(maxThreads); } public int getMaxConnections() { return endpoint.getMaxConnections(); } public void setMaxConnections(int maxConnections) { endpoint.setMaxConnections(maxConnections); }到此为止,server.xml中相关的配置就通过源码解释完毕了。
阅读全文
0 0
- tomcat8关键性源码分析
- Tomcat8源码分析(一)
- Tomcat8源码分析(二)
- Tomcat8源码分析(三)
- Tomcat8源码分析(四)
- Tomcat8.5源码分析-StandardHost
- Tomcat8.5源码分析-HostConfig
- Tomcat8.5源码分析-StandardContext
- Tomcat8.5源码分析-ContextConfig
- Tomcat8.5源码分析-StandardWrapper
- tomcat8源码分析(一):导入eclipse
- tomcat8源码导入
- Eclipse运行Tomcat8源码
- Tomcat8.0.0源码研读
- tomcat8 源码 导入eclipse
- ApproxANN——神经元关键性分析
- Tomcat8.5.11源码导入Myeclipse
- tomcat8.5.15源码编译运行
- 乱码解决方案
- 资讯精选 | 2017年流行的JavaScript前端框架
- Young氏双缝干涉实验近似公式推导的传统谬误
- Tampermonkey
- javascrip练习——99乘法表
- tomcat8关键性源码分析
- C#之入门总结_委托_16
- OLTP与OLAP
- 牛客网 数组中的逆序对
- phanomjsdriver使用和爬虫实例
- vue中如何使用全局变量和全局函数
- 信息检索的评价指标(Precision, Recall, F-score, MAP)
- 8月9日云栖精选夜读:大数据时代_如何构建国家地质基础数据更新体系
- js 模拟搜狐视频纪录片列表展示