Skip to content

Allow Jetty's thread pool to be configured via the environment #5314

@dmwb

Description

@dmwb

Hello,

I'm wondering, if it is possible to have some basic configuration for embedded Jetty in application.properties. Right now to customize thread pool and idle timeout, we're creating bean, which is not convenient...

    @Bean
    public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() {
        final JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(serverProperties.getPort());
        factory.addServerCustomizers((Server server) -> {
            final QueuedThreadPool threadPool = server.getBean(QueuedThreadPool.class);
            threadPool.setMinThreads(appProperties.getMinThreads());
            threadPool.setMaxThreads(appProperties.getMaxThreads());
            threadPool.setIdleTimeout(appProperties.getIdleTimeout());
        });
        return factory;
    }

Could we have something similar like for tomcat and undertow. F.e.

server.jetty.max-threads
server.jetty.min-threads
server.jetty.idle-timeout

Or make it more generic. I'm pretty sure each servlet container has ability to configure such properties.

Thanks!

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions