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