|
|
|
@ -658,15 +658,15 @@ public class ServerProperties
|
|
|
|
|
private Charset uriEncoding;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Maximum number of connections that the server will accept and process
|
|
|
|
|
* at any given time. Once the limit has been reached, the operating system
|
|
|
|
|
* may still accept connections based on the "acceptCount" property.
|
|
|
|
|
* Maximum number of connections that the server will accept and process at any
|
|
|
|
|
* given time. Once the limit has been reached, the operating system may still
|
|
|
|
|
* accept connections based on the "acceptCount" property.
|
|
|
|
|
*/
|
|
|
|
|
private int maxConnections = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Maximum queue length for incoming connection requests when all possible
|
|
|
|
|
* request processing threads are in use.
|
|
|
|
|
* Maximum queue length for incoming connection requests when all possible request
|
|
|
|
|
* processing threads are in use.
|
|
|
|
|
*/
|
|
|
|
|
private int acceptCount = 0;
|
|
|
|
|
|
|
|
|
@ -827,34 +827,37 @@ public class ServerProperties
|
|
|
|
|
public void customize(Connector connector) {
|
|
|
|
|
ProtocolHandler handler = connector.getProtocolHandler();
|
|
|
|
|
if (handler instanceof AbstractProtocol) {
|
|
|
|
|
AbstractProtocol protocol = (AbstractProtocol) handler;
|
|
|
|
|
AbstractProtocol<?> protocol = (AbstractProtocol<?>) handler;
|
|
|
|
|
protocol.setBacklog(Tomcat.this.acceptCount);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void customizeMaxConnections(TomcatEmbeddedServletContainerFactory factory) {
|
|
|
|
|
private void customizeMaxConnections(
|
|
|
|
|
TomcatEmbeddedServletContainerFactory factory) {
|
|
|
|
|
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void customize(Connector connector) {
|
|
|
|
|
ProtocolHandler handler = connector.getProtocolHandler();
|
|
|
|
|
if (handler instanceof AbstractProtocol) {
|
|
|
|
|
AbstractProtocol protocol = (AbstractProtocol) handler;
|
|
|
|
|
AbstractProtocol<?> protocol = (AbstractProtocol<?>) handler;
|
|
|
|
|
protocol.setMaxConnections(Tomcat.this.maxConnections);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void customizeConnectionTimeout(
|
|
|
|
|
TomcatEmbeddedServletContainerFactory factory, int connectionTimeout) {
|
|
|
|
|
for (Connector connector : factory.getAdditionalTomcatConnectors()) {
|
|
|
|
|
if (connector.getProtocolHandler() instanceof AbstractProtocol) {
|
|
|
|
|
AbstractProtocol<?> handler = (AbstractProtocol<?>) connector
|
|
|
|
|
.getProtocolHandler();
|
|
|
|
|
handler.setConnectionTimeout(connectionTimeout);
|
|
|
|
|
ProtocolHandler handler = connector.getProtocolHandler();
|
|
|
|
|
if (handler instanceof AbstractProtocol) {
|
|
|
|
|
AbstractProtocol<?> protocol = (AbstractProtocol<?>) handler;
|
|
|
|
|
protocol.setConnectionTimeout(connectionTimeout);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1108,6 +1111,7 @@ public class ServerProperties
|
|
|
|
|
JettyEmbeddedServletContainerFactory factory,
|
|
|
|
|
final int connectionTimeout) {
|
|
|
|
|
factory.addServerCustomizers(new JettyServerCustomizer() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void customize(Server server) {
|
|
|
|
|
for (org.eclipse.jetty.server.Connector connector : server
|
|
|
|
@ -1118,6 +1122,7 @@ public class ServerProperties
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|