Tomcat 最大连接数实现原理

spring boot 内置tomcat设置连接数 max-connections: 5

java 复制代码
server:
  port: 9898
  servlet:
    context-path: /test
  tomcat:
    connection-timeout: 5000
    max-connections: 5
    accept-count: 5

##初始化连接数量connectionLimitLatch

java 复制代码
protected LimitLatch initializeConnectionLatch() {
        if (maxConnections==-1) return null;
        if (connectionLimitLatch==null) {
            connectionLimitLatch = new LimitLatch(getMaxConnections());
        }
        return connectionLimitLatch;
    }

##Acceptor接收连接的时候加1

##关闭连接减一

##借助AQS类 连接数不能大于限制数量

相关推荐
大爱编程♡11 分钟前
JAVAEE-前端三剑客
java·前端·java-ee
csdnZCjava13 分钟前
Spring MVC工作原理 及注解说明
java·后端·spring·mvc
__万波__13 分钟前
二十三种设计模式(十八)--中介者模式
java·设计模式·中介者模式
weixin_lynhgworld14 分钟前
旧物回收小程序:让闲置物品焕发新生 ✨
java·开发语言·小程序
代码方舟15 分钟前
Java Spring Boot 实战:构建天远高并发个人消费能力评估系统
java·大数据·spring boot·python
未来可期丶18 分钟前
【VSCode】配置JAVA开发环境
java·ide·vscode
小句19 分钟前
arthas-boot.jar 热替换
java·python·jar
k***921620 分钟前
Linux网络编程】应用层协议HTTP(实现一个简单的http服务)
java·开发语言·学习