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类 连接数不能大于限制数量