use of org.apache.coyote.ProtocolHandler in project spring-boot by spring-projects.
the class TomcatWebServerFactoryCustomizer method customizeMaxThreads.
@SuppressWarnings("rawtypes")
private void customizeMaxThreads(ConfigurableTomcatWebServerFactory factory, int maxThreads) {
factory.addConnectorCustomizers((connector) -> {
ProtocolHandler handler = connector.getProtocolHandler();
if (handler instanceof AbstractProtocol) {
AbstractProtocol protocol = (AbstractProtocol) handler;
protocol.setMaxThreads(maxThreads);
}
});
}
use of org.apache.coyote.ProtocolHandler in project spring-boot by spring-projects.
the class SampleTomcatApplicationTests method testTimeout.
@Test
void testTimeout() {
ServletWebServerApplicationContext context = (ServletWebServerApplicationContext) this.applicationContext;
TomcatWebServer embeddedServletContainer = (TomcatWebServer) context.getWebServer();
ProtocolHandler protocolHandler = embeddedServletContainer.getTomcat().getConnector().getProtocolHandler();
int timeout = ((AbstractProtocol<?>) protocolHandler).getConnectionTimeout();
assertThat(timeout).isEqualTo(5000);
}
Aggregations