0
点赞
收藏
分享

微信扫一扫

Tomcat 最大连接数实现原理

前端王祖蓝 2024-08-19 阅读 22
tomcatjava

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

server:
  port: 9898
  servlet:
    context-path: /test
  tomcat:
    connection-timeout: 5000
    max-connections: 5
    accept-count: 5

##初始化连接数量connectionLimitLatch

protected LimitLatch initializeConnectionLatch() {
        if (maxConnections==-1) return null;
        if (connectionLimitLatch==null) {
            connectionLimitLatch = new LimitLatch(getMaxConnections());
        }
        return connectionLimitLatch;
    }

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

##关闭连接减一

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

举报

相关推荐

0 条评论