Search in sources :

Example 16 with JettyWebServer

use of org.springframework.boot.web.embedded.jetty.JettyWebServer in project spring-boot by spring-projects.

the class JettyWebServerFactoryCustomizerTests method threadPoolWithMaxQueueCapacityPositiveCreateBlockingArrayQueue.

@Test
void threadPoolWithMaxQueueCapacityPositiveCreateBlockingArrayQueue() {
    bind("server.jetty.threads.max-queue-capacity=1234");
    JettyWebServer server = customizeAndGetServer();
    ThreadPool threadPool = server.getServer().getThreadPool();
    BlockingQueue<?> queue = getQueue(threadPool);
    assertThat(queue).isInstanceOf(BlockingArrayQueue.class);
    assertThat(((BlockingArrayQueue<?>) queue).getMaxCapacity()).isEqualTo(1234);
    assertDefaultThreadPoolSettings(threadPool);
}
Also used : QueuedThreadPool(org.eclipse.jetty.util.thread.QueuedThreadPool) ThreadPool(org.eclipse.jetty.util.thread.ThreadPool) BlockingArrayQueue(org.eclipse.jetty.util.BlockingArrayQueue) JettyWebServer(org.springframework.boot.web.embedded.jetty.JettyWebServer) Test(org.junit.jupiter.api.Test)

Example 17 with JettyWebServer

use of org.springframework.boot.web.embedded.jetty.JettyWebServer in project spring-boot by spring-projects.

the class ServerPropertiesTests method jettyThreadPoolPropertyDefaultsShouldMatchServerDefault.

@Test
void jettyThreadPoolPropertyDefaultsShouldMatchServerDefault() {
    JettyServletWebServerFactory jettyFactory = new JettyServletWebServerFactory(0);
    JettyWebServer jetty = (JettyWebServer) jettyFactory.getWebServer();
    Server server = jetty.getServer();
    QueuedThreadPool threadPool = (QueuedThreadPool) server.getThreadPool();
    int idleTimeout = threadPool.getIdleTimeout();
    int maxThreads = threadPool.getMaxThreads();
    int minThreads = threadPool.getMinThreads();
    assertThat(this.properties.getJetty().getThreads().getIdleTimeout().toMillis()).isEqualTo(idleTimeout);
    assertThat(this.properties.getJetty().getThreads().getMax()).isEqualTo(maxThreads);
    assertThat(this.properties.getJetty().getThreads().getMin()).isEqualTo(minThreads);
}
Also used : JettyWebServer(org.springframework.boot.web.embedded.jetty.JettyWebServer) Server(org.eclipse.jetty.server.Server) QueuedThreadPool(org.eclipse.jetty.util.thread.QueuedThreadPool) JettyServletWebServerFactory(org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory) AbstractEndpoint(org.apache.tomcat.util.net.AbstractEndpoint) JettyWebServer(org.springframework.boot.web.embedded.jetty.JettyWebServer) Test(org.junit.jupiter.api.Test)

Aggregations

JettyWebServer (org.springframework.boot.web.embedded.jetty.JettyWebServer)17 Test (org.junit.jupiter.api.Test)16 QueuedThreadPool (org.eclipse.jetty.util.thread.QueuedThreadPool)9 JettyServletWebServerFactory (org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory)4 CustomRequestLog (org.eclipse.jetty.server.CustomRequestLog)3 RequestLogWriter (org.eclipse.jetty.server.RequestLogWriter)3 Server (org.eclipse.jetty.server.Server)3 ThreadPool (org.eclipse.jetty.util.thread.ThreadPool)3 File (java.io.File)2 IOException (java.io.IOException)2 AbstractEndpoint (org.apache.tomcat.util.net.AbstractEndpoint)2 BlockingArrayQueue (org.eclipse.jetty.util.BlockingArrayQueue)2 ServletException (jakarta.servlet.ServletException)1 HttpServlet (jakarta.servlet.http.HttpServlet)1 HttpServletRequest (jakarta.servlet.http.HttpServletRequest)1 HttpServletResponse (jakarta.servlet.http.HttpServletResponse)1 Duration (java.time.Duration)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1