Search in sources :

Example 1 with JettyWebServer

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

the class JettyWebServerFactoryCustomizerTests method threadPoolWithMaxQueueCapacityEqualToZeroCreateSynchronousQueue.

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

Example 2 with JettyWebServer

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

the class JettyWebServerFactoryCustomizerTests method threadPoolIdleTimeoutCanBeCustomized.

@Test
void threadPoolIdleTimeoutCanBeCustomized() {
    bind("server.jetty.threads.idle-timeout=100s");
    JettyWebServer server = customizeAndGetServer();
    QueuedThreadPool threadPool = (QueuedThreadPool) server.getServer().getThreadPool();
    assertThat(threadPool.getIdleTimeout()).isEqualTo(100000);
}
Also used : QueuedThreadPool(org.eclipse.jetty.util.thread.QueuedThreadPool) JettyWebServer(org.springframework.boot.web.embedded.jetty.JettyWebServer) Test(org.junit.jupiter.api.Test)

Example 3 with JettyWebServer

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

the class JettyWebServerFactoryCustomizerTests method customMaxHttpHeaderSizeIgnoredIfZero.

@Test
void customMaxHttpHeaderSizeIgnoredIfZero() {
    bind("server.max-http-header-size=0");
    JettyWebServer server = customizeAndGetServer();
    List<Integer> requestHeaderSizes = getRequestHeaderSizes(server);
    assertThat(requestHeaderSizes).containsOnly(8192);
}
Also used : JettyWebServer(org.springframework.boot.web.embedded.jetty.JettyWebServer) Test(org.junit.jupiter.api.Test)

Example 4 with JettyWebServer

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

the class JettyWebServerFactoryCustomizerTests method customizeMaxHttpHeaderSize.

@Test
void customizeMaxHttpHeaderSize() {
    bind("server.max-http-header-size=2048");
    JettyWebServer server = customizeAndGetServer();
    List<Integer> requestHeaderSizes = getRequestHeaderSizes(server);
    assertThat(requestHeaderSizes).containsOnly(2048);
}
Also used : JettyWebServer(org.springframework.boot.web.embedded.jetty.JettyWebServer) Test(org.junit.jupiter.api.Test)

Example 5 with JettyWebServer

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

the class JettyWebServerFactoryCustomizerTests method threadPoolWithMaxQueueCapacityPositiveCustomizesThreadPool.

@Test
void threadPoolWithMaxQueueCapacityPositiveCustomizesThreadPool() {
    bind("server.jetty.threads.max-queue-capacity=1234", "server.jetty.threads.min=10", "server.jetty.threads.max=150", "server.jetty.threads.idle-timeout=3s");
    JettyWebServer server = customizeAndGetServer();
    QueuedThreadPool threadPool = (QueuedThreadPool) server.getServer().getThreadPool();
    assertThat(threadPool.getMinThreads()).isEqualTo(10);
    assertThat(threadPool.getMaxThreads()).isEqualTo(150);
    assertThat(threadPool.getIdleTimeout()).isEqualTo(Duration.ofSeconds(3).toMillis());
}
Also used : QueuedThreadPool(org.eclipse.jetty.util.thread.QueuedThreadPool) 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